630 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) 631 #define _CRT_SECURE_NO_WARNINGS 635 #define IMGUI_DEFINE_MATH_OPERATORS 641 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier 647 #define IMGUI_DEBUG_NAV_SCORING 0 648 #define IMGUI_DEBUG_NAV_RECTS 0 652 #pragma warning (disable: 4127) // condition expression is constant 653 #pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff) 654 #pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen 659 #pragma clang diagnostic ignored "-Wunknown-pragmas" // warning : unknown warning group '-Wformat-pedantic *' // not all warnings are known by all clang versions.. so ignoring warnings triggers new warnings on some configuration. great! 660 #pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse. 661 #pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants (typically 0.0f) is ok. 662 #pragma clang diagnostic ignored "-Wformat-nonliteral" // warning : format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code. 663 #pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals. 664 #pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it. 665 #pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // 666 #pragma clang diagnostic ignored "-Wformat-pedantic" // warning : format specifies type 'void *' but the argument has type 'xxxx *' // unreasonable, would lead to casting every %p arg to void*. probably enabled by -pedantic. 667 #pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' // 668 #elif defined(__GNUC__) 669 #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used 670 #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size 671 #pragma GCC diagnostic ignored "-Wformat" // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*' 672 #pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function 673 #pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value 674 #pragma GCC diagnostic ignored "-Wcast-qual" // warning: cast from type 'xxxx' to type 'xxxx' casts away qualifiers 675 #pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked 676 #pragma GCC diagnostic ignored "-Wstrict-overflow" // warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false 681 #define IMGUI_CDECL __cdecl 766 #ifndef IMGUI_DISABLE_DEFAULT_ALLOCATORS 846 memset(
this, 0,
sizeof(*
this));
885 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS 915 ImWchar wchars[wchars_buf_len];
917 for (
int i = 0; i < wchars_buf_len && wchars[i] != 0; i++)
925 #define IM_F32_TO_INT8_UNBOUND(_VAL) ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f))) // Unsaturated, for display purpose 926 #define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255 932 float dot = ap.
x * ab_dir.
x + ap.
y * ab_dir.
y;
935 float ab_len_sqr = ab_dir.
x * ab_dir.
x + ab_dir.
y * ab_dir.
y;
936 if (dot > ab_len_sqr)
938 return a + ab_dir * dot / ab_len_sqr;
943 bool b1 = ((
p.x -
b.x) * (
a.y -
b.y) - (
p.y -
b.y) * (
a.x -
b.x)) < 0.0
f;
944 bool b2 = ((
p.x -
c.x) * (
b.y -
c.y) - (
p.y -
c.y) * (
b.x -
c.x)) < 0.0
f;
945 bool b3 = ((
p.x -
a.x) * (
c.y -
a.y) - (
p.y -
a.y) * (
c.x -
a.x)) < 0.0
f;
946 return ((b1 == b2) && (b2 == b3));
954 const float denom =
v0.x *
v1.y -
v1.x *
v0.y;
955 out_v = (
v2.x *
v1.y -
v1.x *
v2.y) / denom;
956 out_w = (
v0.x *
v2.y -
v2.x *
v0.y) / denom;
957 out_u = 1.0f - out_v - out_w;
968 float m =
ImMin(dist2_ab,
ImMin(dist2_bc, dist2_ca));
979 while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; }
986 while (
count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++;
count--; }
992 if (
count < 1)
return;
999 size_t len = strlen(str) + 1;
1006 for ( ; str < str_end; str++)
1021 while (buf_mid_line > buf_begin && buf_mid_line[-1] !=
'\n')
1023 return buf_mid_line;
1026 const char*
ImStristr(
const char* haystack,
const char* haystack_end,
const char* needle,
const char* needle_end)
1029 needle_end = needle + strlen(needle);
1031 const char un0 = (char)toupper(*needle);
1032 while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))
1034 if (toupper(*haystack) == un0)
1036 const char*
b = needle + 1;
1037 for (
const char*
a = haystack + 1;
b < needle_end;
a++,
b++)
1038 if (toupper(*
a) != toupper(*
b))
1040 if (
b == needle_end)
1051 if (*
src ==
'-') { negative = 1;
src++; }
1052 if (*
src ==
'+') {
src++; }
1054 while (*
src >=
'0' && *
src <=
'9')
1055 v = (
v * 10) + (*
src++ -
'0');
1056 *output = negative ? -
v :
v;
1063 #ifndef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS 1067 va_start(args, fmt);
1068 int w = vsnprintf(
buf, buf_size, fmt, args);
1072 if (
w == -1 ||
w >= (
int)buf_size)
1073 w = (int)buf_size - 1;
1080 int w = vsnprintf(
buf, buf_size, fmt, args);
1083 if (
w == -1 ||
w >= (
int)buf_size)
1084 w = (int)buf_size - 1;
1088 #endif // #ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS 1094 static ImU32 crc32_lut[256] = { 0 };
1097 const ImU32 polynomial = 0xEDB88320;
1098 for (
ImU32 i = 0; i < 256; i++)
1102 crc = (crc >> 1) ^ (
ImU32(-
int(crc & 1)) & polynomial);
1109 const unsigned char* current = (
const unsigned char*)
data;
1115 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *current++];
1120 while (
unsigned char c = *current++)
1126 if (
c ==
'#' && current[0] ==
'#' && current[1] ==
'#')
1128 crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^
c];
1143 unsigned int c = (
unsigned int)-1;
1144 const unsigned char* str = (
const unsigned char*)in_text;
1147 c = (
unsigned int)(*str++);
1151 if ((*str & 0xe0) == 0xc0)
1154 if (in_text_end && in_text_end - (
const char*)str < 2)
return 1;
1155 if (*str < 0xc2)
return 2;
1156 c = (
unsigned int)((*str++ & 0x1f) << 6);
1157 if ((*str & 0xc0) != 0x80)
return 2;
1158 c += (*str++ & 0x3f);
1162 if ((*str & 0xf0) == 0xe0)
1165 if (in_text_end && in_text_end - (
const char*)str < 3)
return 1;
1166 if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf))
return 3;
1167 if (*str == 0xed && str[1] > 0x9f)
return 3;
1168 c = (
unsigned int)((*str++ & 0x0f) << 12);
1169 if ((*str & 0xc0) != 0x80)
return 3;
1170 c += (
unsigned int)((*str++ & 0x3f) << 6);
1171 if ((*str & 0xc0) != 0x80)
return 3;
1172 c += (*str++ & 0x3f);
1176 if ((*str & 0xf8) == 0xf0)
1179 if (in_text_end && in_text_end - (
const char*)str < 4)
return 1;
1180 if (*str > 0xf4)
return 4;
1181 if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf))
return 4;
1182 if (*str == 0xf4 && str[1] > 0x8f)
return 4;
1183 c = (
unsigned int)((*str++ & 0x07) << 18);
1184 if ((*str & 0xc0) != 0x80)
return 4;
1185 c += (
unsigned int)((*str++ & 0x3f) << 12);
1186 if ((*str & 0xc0) != 0x80)
return 4;
1187 c += (
unsigned int)((*str++ & 0x3f) << 6);
1188 if ((*str & 0xc0) != 0x80)
return 4;
1189 c += (*str++ & 0x3f);
1191 if ((
c & 0xFFFFF800) == 0xD800)
return 4;
1203 while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
1213 if (in_text_remaining)
1214 *in_text_remaining = in_text;
1215 return (
int)(buf_out -
buf);
1221 while ((!in_text_end || in_text < in_text_end) && *in_text)
1243 if (buf_size < 2)
return 0;
1244 buf[0] = (char)(0xc0 + (
c >> 6));
1245 buf[1] = (char)(0x80 + (
c & 0x3f));
1248 if (
c >= 0xdc00 &&
c < 0xe000)
1252 if (
c >= 0xd800 &&
c < 0xdc00)
1254 if (buf_size < 4)
return 0;
1255 buf[0] = (char)(0xf0 + (
c >> 18));
1256 buf[1] = (char)(0x80 + ((
c >> 12) & 0x3f));
1257 buf[2] = (char)(0x80 + ((
c >> 6) & 0x3f));
1258 buf[3] = (char)(0x80 + ((
c ) & 0x3f));
1263 if (buf_size < 3)
return 0;
1264 buf[0] = (char)(0xe0 + (
c >> 12));
1265 buf[1] = (char)(0x80 + ((
c>> 6) & 0x3f));
1266 buf[2] = (char)(0x80 + ((
c ) & 0x3f));
1273 if (
c < 0x80)
return 1;
1274 if (
c < 0x800)
return 2;
1275 if (
c >= 0xdc00 &&
c < 0xe000)
return 0;
1276 if (
c >= 0xd800 &&
c < 0xdc00)
return 4;
1282 char* buf_out =
buf;
1283 const char* buf_end =
buf + buf_size;
1284 while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
1286 unsigned int c = (
unsigned int)(*in_text++);
1288 *buf_out++ = (char)
c;
1293 return (
int)(buf_out -
buf);
1298 int bytes_count = 0;
1299 while ((!in_text_end || in_text < in_text_end) && *in_text)
1301 unsigned int c = (
unsigned int)(*in_text++);
1312 float s = 1.0f/255.0f;
1334 c.
w *= style.
Alpha * alpha_mul;
1349 return style.
Colors[idx];
1355 if (style_alpha >= 1.0
f)
1358 a = (int)(
a * style_alpha);
1378 const float chroma =
r - (
g <
b ?
g :
b);
1379 out_h = fabsf(K + (
g -
b) / (6.
f * chroma + 1e-20
f));
1380 out_s = chroma / (
r + 1e-20
f);
1391 out_r = out_g = out_b =
v;
1395 h = fmodf(
h, 1.0
f) / (60.0f/360.0f);
1397 float f =
h - (float)i;
1398 float p =
v * (1.0f -
s);
1399 float q =
v * (1.0f -
s *
f);
1400 float t =
v * (1.0f -
s * (1.0f -
f));
1404 case 0: out_r =
v; out_g =
t; out_b =
p;
break;
1405 case 1: out_r =
q; out_g =
v; out_b =
p;
break;
1406 case 2: out_r =
p; out_g =
v; out_b =
t;
break;
1407 case 3: out_r =
p; out_g =
q; out_b =
v;
break;
1408 case 4: out_r =
t; out_g =
p; out_b =
v;
break;
1409 case 5:
default: out_r =
v; out_g =
p; out_b =
q;
break;
1415 #if defined(_WIN32) && !defined(__CYGWIN__) 1420 buf.resize(filename_wsize + mode_wsize);
1423 return _wfopen((
wchar_t*)&
buf[0], (
wchar_t*)&
buf[filename_wsize]);
1425 return fopen(filename,
mode);
1431 void*
ImFileLoadToMemory(
const char* filename,
const char* file_open_mode,
int* out_file_size,
int padding_bytes)
1441 long file_size_signed;
1442 if (fseek(
f, 0, SEEK_END) || (file_size_signed = ftell(
f)) == -1 || fseek(
f, 0, SEEK_SET))
1448 int file_size = (int)file_size_signed;
1450 if (file_data ==
NULL)
1455 if (fread(file_data, 1, (
size_t)file_size,
f) != (
size_t)file_size)
1461 if (padding_bytes > 0)
1462 memset((
void *)(((
char*)file_data) + file_size), 0, padding_bytes);
1466 *out_file_size = file_size;
1484 size_t count2 =
count >> 1;
1489 count -= count2 + 1;
1504 static int IMGUI_CDECL PairCompareByID(
const void* lhs,
const void* rhs)
1507 if (((
const Pair*)lhs)->
key > ((
const Pair*)rhs)->
key)
return +1;
1508 if (((
const Pair*)lhs)->
key < ((
const Pair*)rhs)->
key)
return -1;
1513 qsort(
Data.Data, (
size_t)
Data.Size,
sizeof(
Pair), StaticFunc::PairCompareByID);
1519 if (it ==
Data.end() || it->key !=
key)
1526 return GetInt(
key, default_val ? 1 : 0) != 0;
1532 if (it ==
Data.end() || it->key !=
key)
1540 if (it ==
Data.end() || it->key !=
key)
1549 if (it ==
Data.end() || it->key !=
key)
1562 if (it ==
Data.end() || it->key !=
key)
1570 if (it ==
Data.end() || it->key !=
key)
1579 if (it ==
Data.end() || it->key !=
key)
1595 if (it ==
Data.end() || it->key !=
key)
1606 if (it ==
Data.end() || it->key !=
key)
1616 for (
int i = 0; i <
Data.Size; i++)
1648 return value_changed;
1655 const char* we = wb;
1658 if (*we == separator)
1676 for (
int i = 0; i !=
Filters.Size; i++)
1681 if (
Filters[i].front() !=
'-')
1694 for (
int i = 0; i !=
Filters.Size; i++)
1699 if (
f.front() ==
'-')
1727 #define va_copy(dest, src) (dest = src) 1740 const int write_off = Buf.Size;
1741 const int needed_sz = write_off +
len;
1742 if (write_off +
len >= Buf.Capacity)
1744 int double_capacity = Buf.Capacity * 2;
1745 Buf.reserve(needed_sz > double_capacity ? needed_sz : double_capacity);
1748 Buf.resize(needed_sz);
1755 va_start(args, fmt);
1756 appendfv(fmt, args);
1767 Spacing = Width = NextWidth = 0.0f;
1768 memset(Pos, 0,
sizeof(Pos));
1769 memset(NextWidths, 0,
sizeof(NextWidths));
1776 Width = NextWidth = 0.0f;
1778 if (clear)
memset(NextWidths, 0,
sizeof(NextWidths));
1779 for (
int i = 0; i < Count; i++)
1781 if (i > 0 && NextWidths[i] > 0.0
f)
1783 Pos[i] = (float)(
int)Width;
1784 Width += NextWidths[i];
1785 NextWidths[i] = 0.0f;
1792 NextWidths[0] =
ImMax(NextWidths[0], w0);
1793 NextWidths[1] =
ImMax(NextWidths[1],
w1);
1794 NextWidths[2] =
ImMax(NextWidths[2],
w2);
1795 for (
int i = 0; i < 3; i++)
1796 NextWidth += NextWidths[i] + ((i > 0 && NextWidths[i] > 0.0
f) ?
Spacing : 0.0
f);
1797 return ImMax(Width, NextWidth);
1802 return ImMax(0.0
f, avail_w - Width);
1827 ItemsHeight = items_height;
1830 DisplayEnd = DisplayStart = -1;
1831 if (ItemsHeight > 0.0
f)
1834 if (DisplayStart > 0)
1845 if (ItemsCount < INT_MAX)
1868 if (ItemsCount == 1) { ItemsCount = -1;
return false; }
1871 Begin(ItemsCount-1, items_height);
1879 IM_ASSERT(DisplayStart >= 0 && DisplayEnd >= 0);
1896 IDStack.push_back(ID);
1898 PosFloat = Pos =
ImVec2(0.0
f, 0.0
f);
1899 Size = SizeFull =
ImVec2(0.0
f, 0.0
f);
1900 SizeContents = SizeContentsExplicit =
ImVec2(0.0
f, 0.0
f);
1901 WindowPadding =
ImVec2(0.0
f, 0.0
f);
1902 WindowRounding = 0.0f;
1903 WindowBorderSize = 0.0f;
1904 MoveId =
GetID(
"#MOVE");
1908 ScrollTargetCenterRatio =
ImVec2(0.5
f, 0.5
f);
1909 ScrollbarX = ScrollbarY =
false;
1910 ScrollbarSizes =
ImVec2(0.0
f, 0.0
f);
1911 Active = WasActive =
false;
1912 WriteAccessed =
false;
1914 CollapseToggleWanted =
false;
1918 BeginOrderWithinParent = -1;
1919 BeginOrderWithinContext = -1;
1922 AutoFitFramesX = AutoFitFramesY = -1;
1923 AutoFitOnlyGrows =
false;
1924 AutoFitChildAxises = 0x00;
1930 LastFrameActive = -1;
1931 ItemWidthDefault = 0.0f;
1932 FontWindowScale = 1.0f;
1935 DrawList->_OwnerName = Name;
1936 ParentWindow =
NULL;
1938 RootWindowForTitleBarHighlight =
NULL;
1939 RootWindowForTabbing =
NULL;
1940 RootWindowForNav =
NULL;
1942 NavLastIds[0] = NavLastIds[1] = 0;
1943 NavRectRel[0] = NavRectRel[1] =
ImRect();
1944 NavLastChildNavWindow =
NULL;
1946 FocusIdxAllCounter = FocusIdxTabCounter = -1;
1947 FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = INT_MAX;
1948 FocusIdxAllRequestNext = FocusIdxTabRequestNext = INT_MAX;
1955 for (
int i = 0; i != ColumnsStorage.Size; i++)
1961 ImGuiID seed = IDStack.back();
1962 ImGuiID id =
ImHash(str, str_end ? (
int)(str_end - str) : 0, seed);
1969 ImGuiID seed = IDStack.back();
1977 ImGuiID seed = IDStack.back();
1978 return ImHash(str, str_end ? (
int)(str_end - str) : 0, seed);
1984 ImGuiID seed = IDStack.back();
1985 const int r_rel[4] = { (int)(r_abs.
Min.
x - Pos.x), (int)(r_abs.
Min.
y - Pos.y), (int)(r_abs.
Max.
x - Pos.x), (int)(r_abs.
Max.
y - Pos.y) };
2000 g.FontSize =
g.DrawListSharedData.FontSize = window->
CalcFontSize();
2007 IM_ASSERT(nav_layer == 0 || nav_layer == 1);
2009 g.NavWindow->NavLastIds[nav_layer] =
id;
2016 g.NavWindow->NavRectRel[nav_layer] = rect_rel;
2017 g.NavMousePosDirty =
true;
2018 g.NavDisableHighlight =
false;
2019 g.NavDisableMouseHover =
true;
2026 if (
g.ActiveIdIsJustActivated)
2027 g.ActiveIdTimer = 0.0f;
2029 g.ActiveIdAllowNavDirFlags = 0;
2030 g.ActiveIdAllowOverlap =
false;
2031 g.ActiveIdWindow = window;
2034 g.ActiveIdIsAlive =
true;
2052 if (
g.NavWindow != window)
2053 g.NavInitRequest =
false;
2055 g.NavWindow = window;
2056 g.NavLayer = nav_layer;
2062 g.NavDisableMouseHover =
true;
2064 g.NavDisableHighlight =
true;
2076 g.HoveredIdAllowOverlap =
false;
2077 g.HoveredIdTimer = (
id != 0 &&
g.HoveredIdPreviousFrame ==
id) ? (
g.HoveredIdTimer +
g.IO.DeltaTime) : 0.0f;
2083 return g.
HoveredId ?
g.HoveredId :
g.HoveredIdPreviousFrame;
2089 if (
g.ActiveId ==
id)
2100 if (focused_root_window->WasActive && focused_root_window != window->
RootWindow)
2147 if (fabsf(dx) > fabsf(dy))
2169 const ImRect& curr =
g.NavScoringRectScreen;
2170 g.NavScoringCount++;
2187 float dby =
NavScoreItemDistInterval(
ImLerp(cand.
Min.
y, cand.
Max.
y, 0.2f),
ImLerp(cand.
Min.
y, cand.
Max.
y, 0.8f),
ImLerp(curr.
Min.
y, curr.
Max.
y, 0.2f),
ImLerp(curr.
Min.
y, curr.
Max.
y, 0.8f));
2188 if (dby != 0.0
f && dbx != 0.0
f)
2189 dbx = (dbx/1000.0f) + ((dbx > 0.0
f) ? +1.0f : -1.0f);
2190 float dist_box = fabsf(dbx) + fabsf(dby);
2195 float dist_center = fabsf(dcx) + fabsf(dcy);
2199 float dax = 0.0f, day = 0.0f, dist_axial = 0.0f;
2200 if (dbx != 0.0
f || dby != 0.0
f)
2205 dist_axial = dist_box;
2208 else if (dcx != 0.0
f || dcy != 0.0
f)
2213 dist_axial = dist_center;
2222 #if IMGUI_DEBUG_NAV_SCORING 2226 ImFormatString(
buf,
IM_ARRAYSIZE(
buf),
"dbox (%.2f,%.2f->%.4f)\ndcen (%.2f,%.2f->%.4f)\nd (%.2f,%.2f->%.4f)\nnav %c, quadrant %c", dbx, dby, dist_box, dcx, dcy, dist_center, dax, day, dist_axial,
"WENS"[
g.NavMoveDir],
"WENS"[quadrant]);
2227 g.OverlayDrawList.AddRect(curr.
Min, curr.
Max,
IM_COL32(255, 200, 0, 100));
2228 g.OverlayDrawList.AddRect(cand.
Min, cand.
Max,
IM_COL32(255,255,0,200));
2230 g.OverlayDrawList.AddText(
g.IO.FontDefault, 13.0f, cand.
Max, ~0U,
buf);
2232 else if (
g.IO.KeyCtrl)
2235 if (quadrant ==
g.NavMoveDir)
2238 g.OverlayDrawList.AddRectFilled(cand.
Min, cand.
Max,
IM_COL32(255, 0, 0, 200));
2239 g.OverlayDrawList.AddText(
g.IO.FontDefault, 13.0f, cand.
Min,
IM_COL32(255, 255, 255, 255),
buf);
2245 bool new_best =
false;
2246 if (quadrant ==
g.NavMoveDir)
2249 if (dist_box < result->DistBox)
2251 result->DistBox = dist_box;
2252 result->DistCenter = dist_center;
2255 if (dist_box ==
result->DistBox)
2258 if (dist_center < result->DistCenter)
2260 result->DistCenter = dist_center;
2263 else if (dist_center ==
result->DistCenter)
2279 if (
result->DistBox ==
FLT_MAX && dist_axial < result->DistAxial)
2283 result->DistAxial = dist_axial;
2295 if (parent_window && parent_window != child_window)
2311 if (
layer == 0 &&
g.NavWindow->NavLastIds[0] != 0)
2326 return g.
NavMoveRequest &&
g.NavMoveResultLocal.ID == 0 &&
g.NavMoveResultOther.ID == 0;
2350 g.NavInitResultId =
id;
2351 g.NavInitResultRectRel = nav_bb_rel;
2355 g.NavInitRequest =
false;
2366 if (!
g.NavMoveRequest)
2367 g.NavMoveDir =
g.NavMoveDirLast;
2377 result->RectRel = nav_bb_rel;
2384 g.NavWindow = window;
2386 g.NavIdIsAlive =
true;
2408 if (
g.NavId ==
id ||
g.NavAnyRequest)
2419 const bool is_clipped =
IsClippedEx(bb,
id,
false);
2437 if (
g.NavDisableMouseHover && !
g.NavDisableHighlight)
2455 if (
g.ActiveId != 0 &&
g.ActiveId != window->
DC.
LastItemId && !
g.ActiveIdAllowOverlap &&
g.ActiveId != window->
MoveId)
2476 if (
g.HoveredId != 0 &&
g.HoveredId !=
id && !
g.HoveredIdAllowOverlap)
2480 if (
g.HoveredWindow != window)
2482 if (
g.ActiveId != 0 &&
g.ActiveId !=
id && !
g.ActiveIdAllowOverlap)
2500 if (
id == 0 ||
id !=
g.ActiveId)
2501 if (clip_even_when_logged || !
g.LogEnabled)
2512 if (allow_keyboard_focus)
2524 g.NavJustTabbedId =
id;
2541 if (
size.x < 0.0f ||
size.y < 0.0f)
2544 size.x = (
size.x == 0.0f) ? default_x :
ImMax(content_max.
x -
g.CurrentWindow->DC.CursorPos.x, 4.0f) +
size.x;
2546 size.y = (
size.y == 0.0f) ? default_y :
ImMax(content_max.
y -
g.CurrentWindow->DC.CursorPos.y, 4.0f) +
size.y;
2552 if (wrap_pos_x < 0.0
f)
2556 if (wrap_pos_x == 0.0
f)
2558 else if (wrap_pos_x > 0.0
f)
2561 return ImMax(wrap_pos_x - pos.
x, 1.0f);
2603 #ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC 2604 IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx);
2638 IM_ASSERT(
GImGui !=
NULL &&
"No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?");
2644 IM_ASSERT(
GImGui !=
NULL &&
"No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?");
2680 bool init_for_nav =
false;
2683 init_for_nav =
true;
2687 g.NavInitRequest =
true;
2688 g.NavInitRequestFromMove =
false;
2689 g.NavInitResultId = 0;
2690 g.NavInitResultRectRel =
ImRect();
2704 return g.IO.MousePos;
2714 for (
int i =
g.Windows.Size-1; i >= 0; i--)
2715 if (
g.Windows[i] == window)
2723 for (
int i = i_start; i >= 0 && i <
g.Windows.Size && i != i_stop; i += dir)
2735 const float t =
g.IO.NavInputsDownDuration[
n];
2737 return (
g.IO.NavInputsDownDurationPrev[
n] >= 0.0f ? 1.0f : 0.0f);
2741 return (
t == 0.0
f) ? 1.0f : 0.0f;
2778 delta *= slow_factor;
2780 delta *= fast_factor;
2794 window_target =
FindWindowNavigable((focus_change_dir < 0) ? (
g.Windows.Size - 1) : 0, i_current, focus_change_dir);
2795 g.NavWindowingTarget = window_target;
2796 g.NavWindowingToggleLayer =
false;
2804 bool apply_toggle_layer =
false;
2808 if (start_windowing_with_gamepad || start_windowing_with_keyboard)
2811 g.NavWindowingTarget = window->RootWindowForTabbing;
2812 g.NavWindowingHighlightTimer =
g.NavWindowingHighlightAlpha = 0.0f;
2813 g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false :
true;
2818 g.NavWindowingHighlightTimer +=
g.IO.DeltaTime;
2822 g.NavWindowingHighlightAlpha =
ImMax(
g.NavWindowingHighlightAlpha,
ImSaturate((
g.NavWindowingHighlightTimer - 0.20f) / 0.05f));
2826 if (focus_change_dir != 0)
2829 g.NavWindowingHighlightAlpha = 1.0f;
2835 g.NavWindowingToggleLayer &= (
g.NavWindowingHighlightAlpha < 1.0f);
2836 if (
g.NavWindowingToggleLayer &&
g.NavWindow)
2837 apply_toggle_layer =
true;
2838 else if (!
g.NavWindowingToggleLayer)
2839 apply_focus_window =
g.NavWindowingTarget;
2840 g.NavWindowingTarget =
NULL;
2848 g.NavWindowingHighlightAlpha =
ImMax(
g.NavWindowingHighlightAlpha,
ImSaturate((
g.NavWindowingHighlightTimer - 0.15f) / 0.04f));
2852 apply_focus_window =
g.NavWindowingTarget;
2859 apply_toggle_layer =
true;
2869 if (move_delta.
x != 0.0f || move_delta.
y != 0.0f)
2871 const float NAV_MOVE_SPEED = 800.0f;
2872 const float move_speed =
ImFloor(NAV_MOVE_SPEED *
g.IO.DeltaTime *
ImMin(
g.IO.DisplayFramebufferScale.x,
g.IO.DisplayFramebufferScale.y));
2873 g.NavWindowingTarget->PosFloat += move_delta * move_speed;
2874 g.NavDisableMouseHover =
true;
2882 g.NavDisableHighlight =
false;
2883 g.NavDisableMouseHover =
true;
2894 if (apply_focus_window)
2895 g.NavWindowingTarget =
NULL;
2898 if (apply_toggle_layer &&
g.NavWindow)
2903 if (new_nav_window !=
g.NavWindow)
2909 g.NavDisableHighlight =
false;
2910 g.NavDisableMouseHover =
true;
2911 NavRestoreLayer((
g.NavWindow->DC.NavLayerActiveMask & (1 << 1)) ? (
g.NavLayer ^ 1) : 0);
2921 if (window_rect_rel.
Contains(item_rect_rel))
2935 if (item_rect_rel.
Min.
y < window_rect_rel.
Min.
y)
2940 else if (item_rect_rel.
Max.
y >= window_rect_rel.
Max.
y)
2957 if (
g.NavScoringCount > 0) printf(
"[%05d] NavScoringCount %d for '%s' layer %d (Init:%d, Move:%d)\n",
g.FrameCount,
g.NavScoringCount,
g.NavWindow ?
g.NavWindow->Name :
"NULL",
g.NavLayer,
g.NavInitRequest ||
g.NavInitResultId != 0,
g.NavMoveRequest);
2964 #define NAV_MAP_KEY(_KEY, _NAV_INPUT) if (g.IO.KeyMap[_KEY] != -1 && IsKeyDown(g.IO.KeyMap[_KEY])) g.IO.NavInputs[_NAV_INPUT] = 1.0f; 2978 memcpy(
g.IO.NavInputsDownDurationPrev,
g.IO.NavInputsDownDuration,
sizeof(
g.IO.NavInputsDownDuration));
2980 g.IO.NavInputsDownDuration[i] = (
g.IO.NavInputs[i] > 0.0f) ? (
g.IO.NavInputsDownDuration[i] < 0.0f ? 0.0f :
g.IO.NavInputsDownDuration[i] +
g.IO.DeltaTime) : -1.0
f;
2983 if (
g.NavInitResultId != 0 && (!
g.NavDisableHighlight ||
g.NavInitRequestFromMove))
2987 if (
g.NavInitRequestFromMove)
2991 g.NavWindow->NavRectRel[
g.NavLayer] =
g.NavInitResultRectRel;
2993 g.NavInitRequest =
false;
2994 g.NavInitRequestFromMove =
false;
2995 g.NavInitResultId = 0;
2996 g.NavJustMovedToId = 0;
2999 if (
g.NavMoveRequest && (
g.NavMoveResultLocal.ID != 0 ||
g.NavMoveResultOther.ID != 0))
3003 if (
g.NavMoveResultOther.ID != 0 &&
g.NavMoveResultOther.Window->ParentWindow ==
g.NavWindow)
3004 if ((
g.NavMoveResultOther.DistBox <
g.NavMoveResultLocal.DistBox) || (
g.NavMoveResultOther.DistBox ==
g.NavMoveResultLocal.DistBox &&
g.NavMoveResultOther.DistCenter <
g.NavMoveResultLocal.DistCenter))
3005 result = &
g.NavMoveResultOther;
3010 if (
g.NavLayer == 0)
3017 g.NavJustMovedToId =
result->ID;
3018 g.NavMoveFromClampedRefRect =
false;
3025 if (
g.NavMoveResultLocal.ID == 0 &&
g.NavMoveResultOther.ID == 0)
3026 g.NavDisableHighlight =
false;
3031 if (
g.NavMousePosDirty &&
g.NavIdIsAlive)
3037 g.IO.WantMoveMouse =
true;
3039 g.NavMousePosDirty =
false;
3041 g.NavIdIsAlive =
false;
3042 g.NavJustTabbedId = 0;
3048 if (
g.NavWindow &&
g.NavWindow->NavLastChildNavWindow !=
NULL &&
g.NavLayer == 0)
3049 g.NavWindow->NavLastChildNavWindow =
NULL;
3055 g.IO.NavVisible = (
g.IO.NavActive &&
g.NavId != 0 && !
g.NavDisableHighlight) || (
g.NavWindowingTarget !=
NULL) ||
g.NavInitRequest;
3060 if (
g.ActiveId != 0)
3072 g.NavIdIsAlive =
false;
3073 if (
g.NavDisableMouseHover)
3074 g.NavMousePosDirty =
true;
3076 else if (
g.OpenPopupStack.Size > 0)
3082 else if (
g.NavLayer != 0)
3091 g.NavWindow->NavLastIds[0] = 0;
3097 g.NavActivateId =
g.NavActivateDownId =
g.NavActivatePressedId =
g.NavInputId = 0;
3102 if (
g.ActiveId == 0 && activate_pressed)
3103 g.NavActivateId =
g.NavId;
3104 if ((
g.ActiveId == 0 ||
g.ActiveId ==
g.NavId) && activate_down)
3105 g.NavActivateDownId =
g.NavId;
3106 if ((
g.ActiveId == 0 ||
g.ActiveId ==
g.NavId) && activate_pressed)
3107 g.NavActivatePressedId =
g.NavId;
3109 g.NavInputId =
g.NavId;
3112 g.NavDisableHighlight =
true;
3113 if (
g.NavActivateId != 0)
3114 IM_ASSERT(
g.NavActivateDownId ==
g.NavActivateId);
3115 g.NavMoveRequest =
false;
3118 if (
g.NavNextActivateId != 0)
3119 g.NavActivateId =
g.NavActivateDownId =
g.NavActivatePressedId =
g.NavInputId =
g.NavNextActivateId;
3120 g.NavNextActivateId = 0;
3123 const int allowed_dir_flags = (
g.ActiveId == 0) ? ~0 :
g.ActiveIdAllowNavDirFlags;
3145 g.NavMoveRequest =
true;
3146 g.NavMoveDirLast =
g.NavMoveDir;
3150 if (
g.NavMoveRequest &&
g.NavId == 0)
3152 g.NavInitRequest =
g.NavInitRequestFromMove =
true;
3153 g.NavInitResultId = 0;
3154 g.NavDisableHighlight =
false;
3179 g.NavMoveFromClampedRefRect =
true;
3181 if (scroll_dir.
y != 0.0f)
3184 g.NavMoveFromClampedRefRect =
true;
3189 g.NavMoveResultLocal.Clear();
3190 g.NavMoveResultOther.Clear();
3193 if (
g.NavMoveRequest &&
g.NavMoveFromClampedRefRect &&
g.NavLayer == 0)
3204 g.NavMoveFromClampedRefRect =
false;
3208 ImRect nav_rect_rel = (
g.NavWindow && !
g.NavWindow->NavRectRel[
g.NavLayer].IsInverted()) ?
g.NavWindow->NavRectRel[
g.NavLayer] :
ImRect(0,0,0,0);
3210 g.NavScoringRectScreen.Min.x =
ImMin(
g.NavScoringRectScreen.Min.x + 1.0f,
g.NavScoringRectScreen.Max.x);
3211 g.NavScoringRectScreen.Max.x =
g.NavScoringRectScreen.Min.x;
3212 IM_ASSERT(!
g.NavScoringRectScreen.IsInverted());
3214 g.NavScoringCount = 0;
3215 #if IMGUI_DEBUG_NAV_RECTS 3216 if (
g.NavWindow) {
for (
int layer = 0;
layer < 2;
layer++)
g.OverlayDrawList.AddRect(
g.NavWindow->Pos +
g.NavWindow->NavRectRel[
layer].Min,
g.NavWindow->Pos +
g.NavWindow->NavRectRel[
layer].Max,
IM_COL32(255,200,0,255)); }
3217 if (
g.NavWindow) {
ImU32 col = (
g.NavWindow->HiddenFrames <= 0) ?
IM_COL32(255,0,255,255) :
IM_COL32(255,0,0,255);
ImVec2 p =
NavCalcPreferredMousePos();
char buf[32];
ImFormatString(
buf, 32,
"%d",
g.NavLayer);
g.OverlayDrawList.AddCircleFilled(
p, 3.0
f, col);
g.OverlayDrawList.AddText(
NULL, 13.0
f,
p +
ImVec2(8,-4), col,
buf); }
3229 IM_ASSERT(
g.MovingWindow &&
g.MovingWindow->RootWindow);
3231 if (
g.IO.MouseDown[0])
3233 ImVec2 pos =
g.IO.MousePos -
g.ActiveIdClickOffset;
3244 g.MovingWindow =
NULL;
3250 if (
g.ActiveIdWindow &&
g.ActiveIdWindow->MoveId ==
g.ActiveId)
3253 if (!
g.IO.MouseDown[0])
3256 g.MovingWindow =
NULL;
3262 IM_ASSERT(
GImGui !=
NULL &&
"No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?");
3268 IM_ASSERT(
g.IO.DeltaTime >= 0.0f &&
"Need a positive DeltaTime (zero is tolerated but will cause some timing issues)");
3269 IM_ASSERT(
g.IO.DisplaySize.x >= 0.0f &&
g.IO.DisplaySize.y >= 0.0f &&
"Invalid DisplaySize value");
3270 IM_ASSERT(
g.IO.Fonts->Fonts.Size > 0 &&
"Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?");
3271 IM_ASSERT(
g.IO.Fonts->Fonts[0]->IsLoaded() &&
"Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?");
3272 IM_ASSERT(
g.Style.CurveTessellationTol > 0.0f &&
"Invalid style setting");
3273 IM_ASSERT(
g.Style.Alpha >= 0.0f &&
g.Style.Alpha <= 1.0f &&
"Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)");
3274 IM_ASSERT((
g.FrameCount == 0 ||
g.FrameCountEnded ==
g.FrameCount) &&
"Forgot to call Render() or EndFrame() at the end of the previous frame?");
3276 IM_ASSERT(
g.IO.KeyMap[
n] >= -1 &&
g.IO.KeyMap[
n] <
IM_ARRAYSIZE(
g.IO.KeysDown) &&
"io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)");
3283 if (!
g.SettingsLoaded)
3287 g.SettingsLoaded =
true;
3290 g.Time +=
g.IO.DeltaTime;
3292 g.TooltipOverrideCount = 0;
3293 g.WindowsActiveCount = 0;
3297 g.DrawListSharedData.ClipRectFullscreen =
ImVec4(0.0
f, 0.0
f,
g.IO.DisplaySize.x,
g.IO.DisplaySize.y);
3298 g.DrawListSharedData.CurveTessellationTol =
g.Style.CurveTessellationTol;
3300 g.OverlayDrawList.Clear();
3301 g.OverlayDrawList.PushTextureID(
g.IO.Fonts->TexID);
3302 g.OverlayDrawList.PushClipRectFullScreen();
3309 if (!
g.HoveredIdPreviousFrame)
3310 g.HoveredIdTimer = 0.0f;
3311 g.HoveredIdPreviousFrame =
g.HoveredId;
3313 g.HoveredIdAllowOverlap =
false;
3314 if (!
g.ActiveIdIsAlive &&
g.ActiveIdPreviousFrame ==
g.ActiveId &&
g.ActiveId != 0)
3317 g.ActiveIdTimer +=
g.IO.DeltaTime;
3318 g.ActiveIdPreviousFrame =
g.ActiveId;
3319 g.ActiveIdIsAlive =
false;
3320 g.ActiveIdIsJustActivated =
false;
3321 if (
g.ScalarAsInputTextId &&
g.ActiveId !=
g.ScalarAsInputTextId)
3322 g.ScalarAsInputTextId = 0;
3325 if (
g.DragDropActive &&
g.DragDropPayload.DataFrameCount + 1 <
g.FrameCount)
3328 g.DragDropPayloadBufHeap.clear();
3329 memset(&
g.DragDropPayloadBufLocal, 0,
sizeof(
g.DragDropPayloadBufLocal));
3331 g.DragDropAcceptIdPrev =
g.DragDropAcceptIdCurr;
3332 g.DragDropAcceptIdCurr = 0;
3333 g.DragDropAcceptIdCurrRectSurface =
FLT_MAX;
3336 memcpy(
g.IO.KeysDownDurationPrev,
g.IO.KeysDownDuration,
sizeof(
g.IO.KeysDownDuration));
3338 g.IO.KeysDownDuration[i] =
g.IO.KeysDown[i] ? (
g.IO.KeysDownDuration[i] < 0.0f ? 0.0f :
g.IO.KeysDownDuration[i] +
g.IO.DeltaTime) : -1.0f;
3346 g.IO.MouseDelta =
g.IO.MousePos -
g.IO.MousePosPrev;
3349 if (
g.IO.MouseDelta.x != 0.0f ||
g.IO.MouseDelta.y != 0.0f)
3350 g.NavDisableMouseHover =
false;
3352 g.IO.MousePosPrev =
g.IO.MousePos;
3355 g.IO.MouseClicked[i] =
g.IO.MouseDown[i] &&
g.IO.MouseDownDuration[i] < 0.0f;
3356 g.IO.MouseReleased[i] = !
g.IO.MouseDown[i] &&
g.IO.MouseDownDuration[i] >= 0.0f;
3357 g.IO.MouseDownDurationPrev[i] =
g.IO.MouseDownDuration[i];
3358 g.IO.MouseDownDuration[i] =
g.IO.MouseDown[i] ? (
g.IO.MouseDownDuration[i] < 0.0f ? 0.0f :
g.IO.MouseDownDuration[i] +
g.IO.DeltaTime) : -1.0
f;
3359 g.IO.MouseDoubleClicked[i] =
false;
3360 if (
g.IO.MouseClicked[i])
3362 if (
g.Time -
g.IO.MouseClickedTime[i] <
g.IO.MouseDoubleClickTime)
3364 if (
ImLengthSqr(
g.IO.MousePos -
g.IO.MouseClickedPos[i]) <
g.IO.MouseDoubleClickMaxDist *
g.IO.MouseDoubleClickMaxDist)
3365 g.IO.MouseDoubleClicked[i] =
true;
3366 g.IO.MouseClickedTime[i] = -
FLT_MAX;
3370 g.IO.MouseClickedTime[i] =
g.Time;
3372 g.IO.MouseClickedPos[i] =
g.IO.MousePos;
3373 g.IO.MouseDragMaxDistanceAbs[i] =
ImVec2(0.0
f, 0.0
f);
3374 g.IO.MouseDragMaxDistanceSqr[i] = 0.0f;
3376 else if (
g.IO.MouseDown[i])
3378 ImVec2 mouse_delta =
g.IO.MousePos -
g.IO.MouseClickedPos[i];
3379 g.IO.MouseDragMaxDistanceAbs[i].
x =
ImMax(
g.IO.MouseDragMaxDistanceAbs[i].x, mouse_delta.
x < 0.0f ? -mouse_delta.
x : mouse_delta.
x);
3380 g.IO.MouseDragMaxDistanceAbs[i].y =
ImMax(
g.IO.MouseDragMaxDistanceAbs[i].y, mouse_delta.
y < 0.0f ? -mouse_delta.
y : mouse_delta.
y);
3381 g.IO.MouseDragMaxDistanceSqr[i] =
ImMax(
g.IO.MouseDragMaxDistanceSqr[i],
ImLengthSqr(mouse_delta));
3383 if (
g.IO.MouseClicked[i])
3384 g.NavDisableMouseHover =
false;
3388 g.FramerateSecPerFrameAccum +=
g.IO.DeltaTime -
g.FramerateSecPerFrame[
g.FramerateSecPerFrameIdx];
3389 g.FramerateSecPerFrame[
g.FramerateSecPerFrameIdx] =
g.IO.DeltaTime;
3390 g.FramerateSecPerFrameIdx = (
g.FramerateSecPerFrameIdx + 1) %
IM_ARRAYSIZE(
g.FramerateSecPerFrame);
3391 g.IO.Framerate = 1.0f / (
g.FramerateSecPerFrameAccum / (float)
IM_ARRAYSIZE(
g.FramerateSecPerFrame));
3397 if (
g.SettingsDirtyTimer > 0.0f)
3399 g.SettingsDirtyTimer -=
g.IO.DeltaTime;
3400 if (
g.SettingsDirtyTimer <= 0.0f)
3409 g.HoveredRootWindow =
g.HoveredWindow ?
g.HoveredWindow->RootWindow :
NULL;
3412 if (modal_window !=
NULL)
3414 g.ModalWindowDarkeningRatio =
ImMin(
g.ModalWindowDarkeningRatio +
g.IO.DeltaTime * 6.0f, 1.0f);
3416 g.HoveredRootWindow =
g.HoveredWindow =
NULL;
3420 g.ModalWindowDarkeningRatio = 0.0f;
3425 int mouse_earliest_button_down = -1;
3426 bool mouse_any_down =
false;
3429 if (
g.IO.MouseClicked[i])
3430 g.IO.MouseDownOwned[i] = (
g.HoveredWindow !=
NULL) || (!
g.OpenPopupStack.empty());
3431 mouse_any_down |=
g.IO.MouseDown[i];
3432 if (
g.IO.MouseDown[i])
3433 if (mouse_earliest_button_down == -1 ||
g.IO.MouseClickedTime[i] <
g.IO.MouseClickedTime[mouse_earliest_button_down])
3434 mouse_earliest_button_down = i;
3436 bool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) ||
g.IO.MouseDownOwned[mouse_earliest_button_down];
3437 if (
g.WantCaptureMouseNextFrame != -1)
3438 g.IO.WantCaptureMouse = (
g.WantCaptureMouseNextFrame != 0);
3440 g.IO.WantCaptureMouse = (mouse_avail_to_imgui && (
g.HoveredWindow !=
NULL || mouse_any_down)) || (!
g.OpenPopupStack.empty());
3442 if (
g.WantCaptureKeyboardNextFrame != -1)
3443 g.IO.WantCaptureKeyboard = (
g.WantCaptureKeyboardNextFrame != 0);
3445 g.IO.WantCaptureKeyboard = (
g.ActiveId != 0) || (modal_window !=
NULL);
3447 g.IO.WantCaptureKeyboard =
true;
3449 g.IO.WantTextInput = (
g.WantTextInputNextFrame != -1) ? (
g.WantTextInputNextFrame != 0) : 0;
3451 g.WantCaptureMouseNextFrame =
g.WantCaptureKeyboardNextFrame =
g.WantTextInputNextFrame = -1;
3457 if (!mouse_avail_to_imgui && !mouse_dragging_extern_payload)
3458 g.HoveredWindow =
g.HoveredRootWindow =
NULL;
3461 if (
g.HoveredWindow && !
g.HoveredWindow->Collapsed && (
g.IO.MouseWheel != 0.0f ||
g.IO.MouseWheelH != 0.0f))
3470 if (
g.IO.MouseWheel != 0.0f)
3472 if (
g.IO.KeyCtrl &&
g.IO.FontAllowUserScaling)
3485 else if (!
g.IO.KeyCtrl && scroll_allowed)
3488 float scroll_amount = 5 * scroll_window->
CalcFontSize();
3493 if (
g.IO.MouseWheelH != 0.0f && scroll_allowed)
3505 if (
g.NavId != 0 &&
g.NavIdTabCounter != INT_MAX)
3506 g.NavWindow->FocusIdxTabRequestNext =
g.NavIdTabCounter + 1 + (
g.IO.KeyShift ? -1 : 1);
3508 g.NavWindow->FocusIdxTabRequestNext =
g.IO.KeyShift ? -1 : 0;
3510 g.NavIdTabCounter = INT_MAX;
3513 for (
int i = 0; i !=
g.Windows.Size; i++)
3522 if (
g.NavWindow && !
g.NavWindow->WasActive)
3527 g.CurrentWindowStack.resize(0);
3528 g.CurrentPopupStack.resize(0);
3534 Begin(
"Debug##Default");
3542 return (
void*)settings;
3550 if (sscanf(line,
"Pos=%f,%f", &
x, &
y) == 2) settings->
Pos =
ImVec2(
x,
y);
3552 else if (sscanf(line,
"Collapsed=%d", &i) == 1) settings->
Collapsed = (i != 0);
3559 for (
int i = 0; i !=
g.Windows.Size; i++)
3567 settings->
Pos = window->
Pos;
3574 buf->reserve(
buf->size() +
g.SettingsWindows.Size * 96);
3575 for (
int i = 0; i !=
g.SettingsWindows.Size; i++)
3581 if (
const char*
p = strstr(
name,
"###"))
3584 buf->appendf(
"Pos=%d,%d\n", (
int)settings->
Pos.
x, (
int)settings->
Pos.
y);
3585 buf->appendf(
"Size=%d,%d\n", (
int)settings->
Size.
x, (
int)settings->
Size.
y);
3604 g.SettingsHandlers.push_front(ini_handler);
3606 g.Initialized =
true;
3615 if (
g.IO.Fonts &&
g.FontAtlasOwnedByContext)
3625 for (
int i = 0; i <
g.Windows.Size; i++)
3628 g.WindowsSortBuffer.clear();
3629 g.CurrentWindow =
NULL;
3630 g.CurrentWindowStack.clear();
3631 g.WindowsById.Clear();
3633 g.HoveredWindow =
NULL;
3634 g.HoveredRootWindow =
NULL;
3635 g.ActiveIdWindow =
NULL;
3636 g.MovingWindow =
NULL;
3637 for (
int i = 0; i <
g.SettingsWindows.Size; i++)
3639 g.ColorModifiers.clear();
3640 g.StyleModifiers.clear();
3641 g.FontStack.clear();
3642 g.OpenPopupStack.clear();
3643 g.CurrentPopupStack.clear();
3644 g.DrawDataBuilder.ClearFreeMemory();
3645 g.OverlayDrawList.ClearFreeMemory();
3646 g.PrivateClipboard.clear();
3647 g.InputTextState.Text.clear();
3648 g.InputTextState.InitialText.clear();
3649 g.InputTextState.TempTextBuffer.clear();
3651 g.SettingsWindows.clear();
3652 g.SettingsHandlers.clear();
3654 if (
g.LogFile &&
g.LogFile != stdout)
3662 g.Initialized =
false;
3668 for (
int i = 0; i !=
g.SettingsWindows.Size; i++)
3669 if (
g.SettingsWindows[i].Id ==
id)
3699 for (
int handler_n = 0; handler_n <
g.SettingsHandlers.Size; handler_n++)
3700 if (
g.SettingsHandlers[handler_n].TypeHash == type_hash)
3701 return &
g.SettingsHandlers[handler_n];
3710 char* buf_end =
buf + strlen(
buf);
3713 void* entry_data =
NULL;
3716 char* line_end =
NULL;
3717 for (
char* line =
buf; line < buf_end; line = line_end + 1)
3720 while (*line ==
'\n' || *line ==
'\r')
3723 while (line_end < buf_end && *line_end !=
'\n' && *line_end !=
'\r')
3727 if (line[0] ==
'[' && line_end > line && line_end[-1] ==
']')
3731 const char* name_end = line_end - 1;
3732 const char* type_start = line + 1;
3734 const char* name_start = type_end ?
ImStrchrRange(type_end + 1, name_end,
'[') :
NULL;
3735 if (!type_end || !name_start)
3737 name_start = type_start;
3738 type_start =
"Window";
3746 entry_data = entry_handler ? entry_handler->
ReadOpenFn(&
g, entry_handler, name_start) :
NULL;
3748 else if (entry_handler !=
NULL && entry_data !=
NULL)
3751 entry_handler->
ReadLineFn(&
g, entry_handler, entry_data, line);
3755 g.SettingsLoaded =
true;
3771 fwrite(
buf.Data,
sizeof(
char), (
size_t)
buf.Size,
f);
3781 for (
int handler_n = 0; handler_n <
g.SettingsHandlers.Size; handler_n++)
3794 if (
g.SettingsDirtyTimer <= 0.0f)
3802 if (
g.SettingsDirtyTimer <= 0.0f)
3815 return (
a->BeginOrderWithinParent -
b->BeginOrderWithinParent);
3826 for (
int i = 0; i <
count; i++)
3863 IM_ASSERT(draw_list->
_VtxCurrentIdx < (1 << 16) &&
"Too many vertices in ImDrawList using 16-bit indices. Read comment above");
3891 int n = Layers[0].Size;
3894 size += Layers[i].Size;
3895 Layers[0].resize(
size);
3896 for (
int layer_n = 1; layer_n <
IM_ARRAYSIZE(Layers); layer_n++)
3909 out_draw_data->
Valid =
true;
3913 for (
int n = 0;
n < draw_lists->
Size;
n++)
3924 window->
DrawList->
PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect);
3940 if (
g.FrameCountEnded ==
g.FrameCount)
3944 if (
g.IO.ImeSetInputScreenPosFn &&
ImLengthSqr(
g.OsImePosRequest -
g.OsImePosSet) > 0.0001f)
3946 g.IO.ImeSetInputScreenPosFn((
int)
g.OsImePosRequest.x, (
int)
g.OsImePosRequest.y);
3947 g.OsImePosSet =
g.OsImePosRequest;
3952 if (
g.CurrentWindow && !
g.CurrentWindow->WriteAccessed)
3953 g.CurrentWindow->Active =
false;
3956 if (
g.ActiveId == 0 &&
g.HoveredId == 0)
3958 if (!
g.NavWindow || !
g.NavWindow->Appearing)
3961 if (
g.IO.MouseClicked[0])
3963 if (
g.HoveredRootWindow !=
NULL)
3968 g.NavDisableHighlight =
true;
3969 g.ActiveIdClickOffset =
g.IO.MousePos -
g.HoveredRootWindow->Pos;
3971 g.MovingWindow =
g.HoveredWindow;
3982 if (
g.IO.MouseClicked[1])
3987 bool hovered_window_above_modal =
false;
3989 hovered_window_above_modal =
true;
3990 for (
int i =
g.Windows.Size - 1; i >= 0 && hovered_window_above_modal ==
false; i--)
3993 if (window == modal)
3995 if (window ==
g.HoveredWindow)
3996 hovered_window_above_modal =
true;
4005 g.WindowsSortBuffer.resize(0);
4006 g.WindowsSortBuffer.reserve(
g.Windows.Size);
4007 for (
int i = 0; i !=
g.Windows.Size; i++)
4015 IM_ASSERT(
g.Windows.Size ==
g.WindowsSortBuffer.Size);
4016 g.Windows.swap(
g.WindowsSortBuffer);
4019 g.IO.MouseWheel =
g.IO.MouseWheelH = 0.0f;
4020 memset(
g.IO.InputCharacters, 0,
sizeof(
g.IO.InputCharacters));
4021 memset(
g.IO.NavInputs, 0,
sizeof(
g.IO.NavInputs));
4023 g.FrameCountEnded =
g.FrameCount;
4031 if (
g.FrameCountEnded !=
g.FrameCount)
4033 g.FrameCountRendered =
g.FrameCount;
4037 if (
g.Style.Alpha > 0.0f)
4040 g.IO.MetricsRenderVertices =
g.IO.MetricsRenderIndices =
g.IO.MetricsActiveWindows = 0;
4041 g.DrawDataBuilder.Clear();
4043 for (
int n = 0;
n !=
g.Windows.Size;
n++)
4049 if (window_to_render_front_most && window_to_render_front_most->
Active && window_to_render_front_most->
HiddenFrames <= 0)
4051 g.DrawDataBuilder.FlattenIntoSingleLayer();
4055 if (
g.IO.MouseDrawCursor &&
g.IO.Fonts->GetMouseCursorTexData(
g.MouseCursor, &
offset, &
size, &uv[0], &uv[2]))
4059 const float sc =
g.Style.MouseCursorScale;
4060 g.OverlayDrawList.PushTextureID(tex_id);
4061 g.OverlayDrawList.AddImage(tex_id, pos +
ImVec2(1,0)*sc, pos+
ImVec2(1,0)*sc +
size*sc, uv[2], uv[3],
IM_COL32(0,0,0,48));
4062 g.OverlayDrawList.AddImage(tex_id, pos +
ImVec2(2,0)*sc, pos+
ImVec2(2,0)*sc +
size*sc, uv[2], uv[3],
IM_COL32(0,0,0,48));
4063 g.OverlayDrawList.AddImage(tex_id, pos, pos +
size*sc, uv[2], uv[3],
IM_COL32(0,0,0,255));
4064 g.OverlayDrawList.AddImage(tex_id, pos, pos +
size*sc, uv[0], uv[1],
IM_COL32(255,255,255,255));
4065 g.OverlayDrawList.PopTextureID();
4067 if (!
g.OverlayDrawList.VtxBuffer.empty())
4072 g.IO.MetricsRenderVertices =
g.DrawData.TotalVtxCount;
4073 g.IO.MetricsRenderIndices =
g.DrawData.TotalIdxCount;
4076 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS 4077 if (
g.DrawData.CmdListsCount > 0 &&
g.IO.RenderDrawListsFn !=
NULL)
4078 g.IO.RenderDrawListsFn(&
g.DrawData);
4085 const char* text_display_end = text;
4087 text_end = (
const char*)-1;
4089 while (text_display_end < text_end && *text_display_end !=
'\0' && (text_display_end[0] !=
'#' || text_display_end[1] !=
'#'))
4091 return text_display_end;
4102 va_start(args, fmt);
4105 vfprintf(
g.LogFile, fmt, args);
4109 g.LogClipboard->appendfv(fmt, args);
4124 const bool log_new_line = ref_pos && (ref_pos->
y > window->
DC.
LogLinePosY + 1);
4128 const char* text_remaining = text;
4131 const int tree_depth = (window->
DC.
TreeDepth -
g.LogStartDepth);
4135 const char* line_end = text_remaining;
4136 while (line_end < text_end)
4137 if (*line_end ==
'\n')
4141 if (line_end >= text_end)
4144 const bool is_first_line = (text == text_remaining);
4145 bool is_last_line =
false;
4146 if (line_end ==
NULL)
4148 is_last_line =
true;
4149 line_end = text_end;
4151 if (line_end !=
NULL && !(is_last_line && (line_end - text_remaining)==0))
4153 const int char_count = (int)(line_end - text_remaining);
4154 if (log_new_line || !is_first_line)
4162 text_remaining = line_end + 1;
4174 const char* text_display_end;
4175 if (hide_text_after_hash)
4182 text_end = text + strlen(text);
4183 text_display_end = text_end;
4186 const int text_len = (int)(text_display_end - text);
4201 text_end = text + strlen(text);
4203 const int text_len = (int)(text_end - text);
4218 const int text_len = (int)(text_display_end - text);
4227 const ImVec2 text_size = text_size_if_known ? *text_size_if_known :
CalcTextSize(text, text_display_end,
false, 0.0
f);
4229 const ImVec2* clip_min = clip_rect ? &clip_rect->
Min : &pos_min;
4230 const ImVec2* clip_max = clip_rect ? &clip_rect->
Max : &pos_max;
4231 bool need_clipping = (pos.
x + text_size.
x >= clip_max->
x) || (pos.
y + text_size.
y >= clip_max->
y);
4233 need_clipping |= (pos.
x < clip_min->
x) || (pos.
y < clip_min->
y);
4236 if (align.
x > 0.0f) pos.
x =
ImMax(pos.
x, pos.
x + (pos_max.
x - pos.
x - text_size.
x) * align.
x);
4237 if (align.
y > 0.0f) pos.
y =
ImMax(pos.
y, pos.
y + (pos_max.
y - pos.
y - text_size.
y) * align.
y);
4242 ImVec4 fine_clip_rect(clip_min->
x, clip_min->
y, clip_max->
x, clip_max->
y);
4259 const float border_size =
g.Style.FrameBorderSize;
4260 if (
border && border_size > 0.0
f)
4271 const float border_size =
g.Style.FrameBorderSize;
4272 if (border_size > 0.0
f)
4285 const float h =
g.FontSize * 1.00f;
4295 center.
y -=
r * 0.25f;
4303 center.
x -=
r * 0.25f;
4329 float thickness =
ImMax(sz / 5.0
f, 1.0
f);
4330 sz -= thickness*0.5f;
4331 pos +=
ImVec2(thickness*0.25
f, thickness*0.25
f);
4333 float third = sz / 3.0f;
4334 float bx = pos.
x + third;
4335 float by = pos.
y + sz - third*0.5f;
4354 ImRect display_rect = bb;
4358 const float THICKNESS = 2.0f;
4359 const float DISTANCE = 3.0f + THICKNESS * 0.5f;
4360 display_rect.Expand(
ImVec2(DISTANCE,DISTANCE));
4380 const char* text_display_end;
4381 if (hide_text_after_double_hash)
4384 text_display_end = text_end;
4388 if (text == text_display_end)
4389 return ImVec2(0.0
f, font_size);
4393 const float font_scale = font_size / font->
FontSize;
4394 const float character_spacing_x = 1.0f * font_scale;
4395 if (text_size.
x > 0.0f)
4396 text_size.
x -= character_spacing_x;
4397 text_size.
x = (float)(
int)(text_size.
x + 0.95f);
4412 *out_items_display_start = 0;
4413 *out_items_display_end = items_count;
4418 *out_items_display_start = *out_items_display_end = 0;
4432 *out_items_display_start =
start;
4433 *out_items_display_end =
end;
4441 for (
int i =
g.Windows.Size - 1; i >= 0; i--)
4466 ImRect rect_clipped(r_min, r_max);
4471 const ImRect rect_for_touch(rect_clipped.
Min -
g.Style.TouchExtraPadding, rect_clipped.
Max +
g.Style.TouchExtraPadding);
4472 return rect_for_touch.
Contains(
g.IO.MousePos);
4490 if (user_key_index < 0)
return false;
4499 if (
t <= repeat_delay || repeat_rate <= 0.0
f)
4501 const int count = (int)((
t - repeat_delay) / repeat_rate) - (
int)((t_prev - repeat_delay) / repeat_rate);
4508 if (key_index < 0)
return false;
4510 const float t =
g.IO.KeysDownDuration[key_index];
4517 if (user_key_index < 0)
return false;
4519 const float t =
g.IO.KeysDownDuration[user_key_index];
4522 if (repeat &&
t >
g.IO.KeyRepeatDelay)
4530 if (user_key_index < 0)
return false;
4532 return g.IO.KeysDownDurationPrev[user_key_index] >= 0.0f && !
g.IO.KeysDown[user_key_index];
4539 return g.IO.MouseDown[button];
4546 if (
g.IO.MouseDown[
n])
4555 const float t =
g.IO.MouseDownDuration[button];
4559 if (repeat &&
t >
g.IO.KeyRepeatDelay)
4561 float delay =
g.IO.KeyRepeatDelay, rate =
g.IO.KeyRepeatRate;
4562 if ((fmodf(
t - delay, rate) > rate*0.5
f) != (fmodf(
t - delay -
g.IO.DeltaTime, rate) > rate*0.5f))
4573 return g.IO.MouseReleased[button];
4580 return g.IO.MouseDoubleClicked[button];
4587 if (!
g.IO.MouseDown[button])
4589 if (lock_threshold < 0.0
f)
4590 lock_threshold =
g.IO.MouseDragThreshold;
4591 return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;
4603 if (
g.CurrentPopupStack.Size > 0)
4605 return g.IO.MousePos;
4611 if (mouse_pos ==
NULL)
4613 const float MOUSE_INVALID = -256000.0f;
4614 return mouse_pos->
x >= MOUSE_INVALID && mouse_pos->
y >= MOUSE_INVALID;
4622 if (lock_threshold < 0.0
f)
4623 lock_threshold =
g.IO.MouseDragThreshold;
4624 if (
g.IO.MouseDown[button])
4625 if (
g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold)
4626 return g.IO.MousePos -
g.IO.MouseClickedPos[button];
4635 g.IO.MouseClickedPos[button] =
g.IO.MousePos;
4672 return g.
NavId && !
g.NavDisableHighlight &&
g.NavId ==
g.CurrentWindow->DC.LastItemId;
4683 return g.
HoveredId != 0 ||
g.HoveredIdPreviousFrame != 0;
4695 return g.
NavId != 0 && !
g.NavDisableHighlight;
4708 if (
g.HoveredId ==
g.CurrentWindow->DC.LastItemId)
4710 if (
g.ActiveId ==
g.CurrentWindow->DC.LastItemId)
4711 g.ActiveIdAllowOverlap =
true;
4735 if (
g.IO.DisplayVisibleMin.x !=
g.IO.DisplayVisibleMax.x &&
g.IO.DisplayVisibleMin.y !=
g.IO.DisplayVisibleMax.y)
4736 return ImRect(
g.IO.DisplayVisibleMin,
g.IO.DisplayVisibleMax);
4737 return ImRect(0.0
f, 0.0
f,
g.IO.DisplaySize.x,
g.IO.DisplaySize.y);
4744 char window_name[16];
4746 if (override_previous_tooltip)
4751 window->HiddenFrames = 1;
4768 va_start(args, fmt);
4792 int current_stack_size =
g.CurrentPopupStack.
Size;
4802 if (
g.OpenPopupStack.Size < current_stack_size + 1)
4804 g.OpenPopupStack.push_back(popup_ref);
4809 g.OpenPopupStack.resize(current_stack_size + 1);
4814 if (
g.OpenPopupStack[current_stack_size].PopupId ==
id &&
g.OpenPopupStack[current_stack_size].OpenFrameCount ==
g.FrameCount - 1)
4815 g.OpenPopupStack[current_stack_size].OpenFrameCount = popup_ref.
OpenFrameCount;
4817 g.OpenPopupStack[current_stack_size] = popup_ref;
4835 if (
g.OpenPopupStack.empty())
4843 for (
n = 0;
n <
g.OpenPopupStack.Size;
n++)
4853 bool has_focus =
false;
4854 for (
int m =
n;
m <
g.OpenPopupStack.Size && !has_focus;
m++)
4855 has_focus = (
g.OpenPopupStack[
m].Window &&
g.OpenPopupStack[
m].Window->RootWindow == ref_window->
RootWindow);
4860 if (
n <
g.OpenPopupStack.Size)
4867 for (
int n =
g.OpenPopupStack.Size-1;
n >= 0;
n--)
4879 if (
g.NavLayer == 0)
4883 g.OpenPopupStack.resize(remaining);
4899 if (popup_idx < 0 || popup_idx >=
g.OpenPopupStack.Size ||
g.CurrentPopupStack[popup_idx].PopupId !=
g.OpenPopupStack[popup_idx].PopupId)
4901 while (popup_idx > 0 &&
g.OpenPopupStack[popup_idx].Window && (
g.OpenPopupStack[popup_idx].Window->Flags &
ImGuiWindowFlags_ChildMenu))
4931 if (
g.OpenPopupStack.Size <=
g.CurrentPopupStack.Size)
4942 return g.
OpenPopupStack.
Size >
g.CurrentPopupStack.Size &&
g.OpenPopupStack[
g.CurrentPopupStack.Size].PopupId ==
id;
4948 return g.
OpenPopupStack.
Size >
g.CurrentPopupStack.Size &&
g.OpenPopupStack[
g.CurrentPopupStack.Size].PopupId ==
g.CurrentWindow->GetID(str_id);
4958 g.NextWindowData.Clear();
4964 if (
g.NextWindowData.PosCond == 0)
4968 if (!is_open || (p_open && !*p_open))
5032 str_id =
"window_context";
5043 str_id =
"void_context";
5065 const float backup_border_size =
g.Style.ChildBorderSize;
5067 g.Style.ChildBorderSize = 0.0f;
5068 flags |= extra_flags;
5081 g.Style.ChildBorderSize = backup_border_size;
5172 {
int current = window->
IDStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushID/PopID or TreeNode/TreePop Mismatch!"); p_backup++; }
5173 {
int current = window->
DC.
GroupStack.
Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"BeginGroup/EndGroup Mismatch!"); p_backup++; }
5174 {
int current =
g.CurrentPopupStack.Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"BeginMenu/EndMenu or BeginPopup/EndPopup Mismatch"); p_backup++;}
5175 {
int current =
g.ColorModifiers.Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushStyleColor/PopStyleColor Mismatch!"); p_backup++; }
5176 {
int current =
g.StyleModifiers.Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushStyleVar/PopStyleVar Mismatch!"); p_backup++; }
5177 {
int current =
g.FontStack.Size;
if (write) *p_backup = current;
else IM_ASSERT(*p_backup == current &&
"PushFont/PopFont Mismatch!"); p_backup++; }
5206 const ImGuiDir dir = (
n == -1) ? *last_dir : dir_prefered_order[
n];
5207 if (
n != -1 && dir == *last_dir)
5225 const ImGuiDir dir = (
n == -1) ? *last_dir : dir_prefered_order[
n];
5226 if (
n != -1 && dir == *last_dir)
5230 if (avail_w <
size.x || avail_h <
size.y)
5268 g.WindowsById.SetVoidPtr(window->
ID, window);
5282 window->
Collapsed = settings->Collapsed;
5284 size = settings->Size;
5296 if (window->
Size.
x <= 0.0f)
5298 if (window->
Size.
y <= 0.0f)
5304 g.Windows.insert(
g.Windows.begin(), window);
5306 g.Windows.push_back(window);
5313 if (
g.NextWindowData.SizeConstraintCond != 0)
5316 ImRect cr =
g.NextWindowData.SizeConstraintRect;
5319 if (
g.NextWindowData.SizeCallback)
5322 data.UserData =
g.NextWindowData.SizeCallbackUserData;
5325 data.DesiredSize = new_size;
5326 g.NextWindowData.SizeCallback(&
data);
5327 new_size =
data.DesiredSize;
5334 new_size =
ImMax(new_size,
g.Style.WindowMinSize);
5357 size_auto_fit = size_contents;
5369 return size_auto_fit;
5413 ImVec2 size_expected = pos_max - pos_min;
5416 if (corner_norm.
x == 0.0f)
5417 out_pos->
x -= (size_constrained.
x - size_expected.
x);
5418 if (corner_norm.
y == 0.0f)
5419 out_pos->
y -= (size_constrained.
y - size_expected.
y);
5420 *out_size = size_constrained;
5441 if (thickness == 0.0
f) rect.
Max -=
ImVec2(1,1);
5442 if (border_n == 0)
return ImRect(rect.
Min.
x + perp_padding, rect.
Min.
y, rect.
Max.
x - perp_padding, rect.
Min.
y + thickness);
5443 if (border_n == 1)
return ImRect(rect.
Max.
x - thickness, rect.
Min.
y + perp_padding, rect.
Max.
x, rect.
Max.
y - perp_padding);
5444 if (border_n == 2)
return ImRect(rect.
Min.
x + perp_padding, rect.
Max.
y - thickness, rect.
Max.
x - perp_padding, rect.
Max.
y);
5445 if (border_n == 3)
return ImRect(rect.
Min.
x, rect.
Min.
y + perp_padding, rect.
Min.
x + thickness, rect.
Max.
y - perp_padding);
5459 const float grip_draw_size = (float)(
int)
ImMax(
g.FontSize * 1.35f, window->
WindowRounding + 1.0f +
g.FontSize * 0.2f);
5460 const float grip_hover_size = (float)(
int)(grip_draw_size * 0.75f);
5467 for (
int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
5473 ImRect resize_rect(corner, corner + grip.
InnerDir * grip_hover_size);
5477 if (hovered || held)
5480 if (
g.HoveredWindow == window && held &&
g.IO.MouseDoubleClicked[0] && resize_grip_n == 0)
5493 if (resize_grip_n == 0 || held || hovered)
5496 for (
int border_n = 0; border_n < resize_border_count; border_n++)
5498 const float BORDER_SIZE = 5.0f;
5499 const float BORDER_APPEAR_TIMER = 0.05f;
5503 if ((hovered &&
g.HoveredIdTimer > BORDER_APPEAR_TIMER) || held)
5506 if (held) *border_held = border_n;
5512 if (border_n == 0) { border_posn =
ImVec2(0, 0); border_target.
y = (
g.IO.MousePos.y -
g.ActiveIdClickOffset.y); }
5513 if (border_n == 1) { border_posn =
ImVec2(1, 0); border_target.
x = (
g.IO.MousePos.x -
g.ActiveIdClickOffset.x + BORDER_SIZE); }
5514 if (border_n == 2) { border_posn =
ImVec2(0, 1); border_target.
y = (
g.IO.MousePos.y -
g.ActiveIdClickOffset.y + BORDER_SIZE); }
5515 if (border_n == 3) { border_posn =
ImVec2(0, 0); border_target.
x = (
g.IO.MousePos.x -
g.ActiveIdClickOffset.x); }
5522 if (
g.NavWindowingTarget == window)
5529 if (nav_resize_delta.
x != 0.0f || nav_resize_delta.
y != 0.0f)
5531 const float NAV_RESIZE_SPEED = 600.0f;
5532 nav_resize_delta *=
ImFloor(NAV_RESIZE_SPEED *
g.IO.DeltaTime *
ImMin(
g.IO.DisplayFramebufferScale.x,
g.IO.DisplayFramebufferScale.y));
5533 g.NavWindowingToggleLayer =
false;
5534 g.NavDisableMouseHover =
true;
5575 ImVec2 size_on_first_use = (
g.NextWindowData.SizeCond != 0) ?
g.NextWindowData.SizeVal :
ImVec2(0.0
f, 0.0
f);
5586 const int current_frame =
g.FrameCount;
5587 const bool first_begin_of_the_frame = (window->
LastFrameActive != current_frame);
5588 if (first_begin_of_the_frame)
5594 bool window_just_activated_by_user = (window->
LastFrameActive < current_frame - 1);
5595 const bool window_just_appearing_after_hidden_for_resize = (window->
HiddenFrames == 1);
5598 ImGuiPopupRef& popup_ref =
g.OpenPopupStack[
g.CurrentPopupStack.Size];
5599 window_just_activated_by_user |= (window->
PopupId != popup_ref.
PopupId);
5600 window_just_activated_by_user |= (window != popup_ref.
Window);
5602 window->
Appearing = (window_just_activated_by_user || window_just_appearing_after_hidden_for_resize);
5608 ImGuiWindow* parent_window_in_stack =
g.CurrentWindowStack.empty() ?
NULL :
g.CurrentWindowStack.back();
5613 g.CurrentWindowStack.push_back(window);
5618 ImGuiPopupRef& popup_ref =
g.OpenPopupStack[
g.CurrentPopupStack.Size];
5619 popup_ref.
Window = window;
5620 g.CurrentPopupStack.push_back(popup_ref);
5628 bool window_pos_set_by_api =
false;
5629 bool window_size_x_set_by_api =
false, window_size_y_set_by_api =
false;
5630 if (
g.NextWindowData.PosCond)
5633 if (window_pos_set_by_api &&
ImLengthSqr(
g.NextWindowData.PosPivotVal) > 0.00001f)
5643 SetWindowPos(window,
g.NextWindowData.PosVal,
g.NextWindowData.PosCond);
5645 g.NextWindowData.PosCond = 0;
5647 if (
g.NextWindowData.SizeCond)
5649 window_size_x_set_by_api = (window->
SetWindowSizeAllowFlags &
g.NextWindowData.SizeCond) != 0 && (
g.NextWindowData.SizeVal.x > 0.0f);
5650 window_size_y_set_by_api = (window->
SetWindowSizeAllowFlags &
g.NextWindowData.SizeCond) != 0 && (
g.NextWindowData.SizeVal.y > 0.0f);
5651 SetWindowSize(window,
g.NextWindowData.SizeVal,
g.NextWindowData.SizeCond);
5652 g.NextWindowData.SizeCond = 0;
5654 if (
g.NextWindowData.ContentSizeCond)
5660 g.NextWindowData.ContentSizeCond = 0;
5662 else if (first_begin_of_the_frame)
5666 if (
g.NextWindowData.CollapsedCond)
5669 g.NextWindowData.CollapsedCond = 0;
5671 if (
g.NextWindowData.FocusCond)
5674 g.NextWindowData.FocusCond = 0;
5680 if (first_begin_of_the_frame)
5740 if (!window_size_x_set_by_api)
5742 if (!window_size_y_set_by_api)
5754 if (!window_size_x_set_by_api)
5755 window->
SizeFull.
x = size_full_modified.
x = size_auto_fit.
x;
5756 if (!window_size_y_set_by_api)
5757 window->
SizeFull.
y = size_full_modified.
y = size_auto_fit.
y;
5793 if (window_just_activated_by_user)
5797 window->
Pos = window->
PosFloat =
g.CurrentPopupStack.back().OpenPopupPos;
5810 if (window_pos_with_pivot)
5821 ImGuiWindow* parent_menu = parent_window_in_stack;
5838 float sc =
g.Style.MouseCursorScale;
5842 rect_to_avoid =
ImRect(ref_pos.
x - 16, ref_pos.
y - 8, ref_pos.
x + 16, ref_pos.
y + 8);
5844 rect_to_avoid =
ImRect(ref_pos.
x - 16, ref_pos.
y - 8, ref_pos.
x + 24 * sc, ref_pos.
y + 24 * sc);
5853 if (!window_pos_set_by_api && window->
AutoFitFramesX <= 0 && window->
AutoFitFramesY <= 0 &&
g.IO.DisplaySize.x > 0.0f &&
g.IO.DisplaySize.y > 0.0f)
5879 bool want_focus =
false;
5885 int border_held = -1;
5886 ImU32 resize_grip_col[4] = { 0 };
5888 const float grip_draw_size = (float)(
int)
ImMax(
g.FontSize * 1.35f, window->
WindowRounding + 1.0f +
g.FontSize * 0.2f);
5890 UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]);
5909 if (
g.NavWindowingTarget == window)
5928 RenderFrame(title_bar_rect.
Min, title_bar_rect.
Max, title_bar_col,
true, window_rounding);
5929 g.Style.FrameBorderSize = backup_border_size;
5935 if (
g.NextWindowData.BgAlphaCond != 0)
5938 g.NextWindowData.BgAlphaCond = 0;
5966 for (
int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
5978 if (window_border_size > 0.0
f)
5980 if (border_held != -1)
5990 if (
g.NavWindowingTarget == window)
5997 bb.
Expand(-
g.FontSize - 1.0f);
6088 const float PAD = 2.0f;
6100 ImRect text_r = title_bar_rect;
6104 text_r.
Min.
x += pad_left;
6105 text_r.
Max.
x -= pad_right;
6106 ImRect clip_rect = text_r;
6150 if (first_begin_of_the_frame)
6154 g.NextWindowData.SizeConstraintCond = 0;
6171 if (style.
Alpha <= 0.0f)
6180 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS 6184 if (size_first_use.
x != 0.0f || size_first_use.
y != 0.0f)
6188 if (bg_alpha_override >= 0.0
f)
6193 #endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS 6209 g.CurrentWindowStack.pop_back();
6211 g.CurrentPopupStack.pop_back();
6228 const ImGuiID id = window->
GetID(horizontal ?
"#SCROLLX" :
"#SCROLLY");
6232 float other_scrollbar_size_w = other_scrollbar ? style.
ScrollbarSize : 0.0f;
6237 :
ImRect(window_rect.
Max.
x - style.
ScrollbarSize, window->
Pos.
y + border_size, window_rect.
Max.
x - border_size, window_rect.
Max.
y - other_scrollbar_size_w - border_size);
6243 int window_rounding_corners;
6253 float scroll_v = horizontal ? window->
Scroll.
x : window->
Scroll.
y;
6254 float win_size_avail_v = (horizontal ? window->
SizeFull.
x : window->
SizeFull.
y) - other_scrollbar_size_w;
6260 const float win_size_v =
ImMax(
ImMax(win_size_contents_v, win_size_avail_v), 1.0
f);
6261 const float grab_h_pixels =
ImClamp(scrollbar_size_v * (win_size_avail_v / win_size_v), style.
GrabMinSize, scrollbar_size_v);
6262 const float grab_h_norm = grab_h_pixels / scrollbar_size_v;
6266 bool hovered =
false;
6267 const bool previously_held = (
g.ActiveId ==
id);
6270 float scroll_max =
ImMax(1.0
f, win_size_contents_v - win_size_avail_v);
6271 float scroll_ratio =
ImSaturate(scroll_v / scroll_max);
6272 float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
6273 if (held && grab_h_norm < 1.0
f)
6275 float scrollbar_pos_v = horizontal ? bb.
Min.
x : bb.
Min.
y;
6276 float mouse_pos_v = horizontal ?
g.IO.MousePos.x :
g.IO.MousePos.y;
6277 float* click_delta_to_grab_center_v = horizontal ? &
g.ScrollbarClickDeltaToGrabCenter.x : &
g.ScrollbarClickDeltaToGrabCenter.y;
6280 const float clicked_v_norm =
ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
6283 bool seek_absolute =
false;
6284 if (!previously_held)
6287 if (clicked_v_norm >= grab_v_norm && clicked_v_norm <= grab_v_norm + grab_h_norm)
6289 *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f;
6293 seek_absolute =
true;
6294 *click_delta_to_grab_center_v = 0.0f;
6300 const float scroll_v_norm =
ImSaturate((clicked_v_norm - *click_delta_to_grab_center_v - grab_h_norm*0.5
f) / (1.0
f - grab_h_norm));
6301 scroll_v = (float)(
int)(0.5f + scroll_v_norm * scroll_max);
6308 scroll_ratio =
ImSaturate(scroll_v / scroll_max);
6309 grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
6313 *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f;
6330 if (current_front_window == window || current_front_window->
RootWindow == window)
6332 for (
int i =
g.Windows.Size - 2; i >= 0; i--)
6333 if (
g.Windows[i] == window)
6335 g.Windows.erase(
g.Windows.Data + i);
6336 g.Windows.push_back(window);
6344 if (
g.Windows[0] == window)
6346 for (
int i = 0; i <
g.Windows.Size; i++)
6347 if (
g.Windows[i] == window)
6350 g.Windows[0] = window;
6360 if (
g.NavWindow != window)
6363 if (window &&
g.NavDisableMouseHover)
6364 g.NavMousePosDirty =
true;
6365 g.NavInitRequest =
false;
6367 g.NavIdIsAlive =
false;
6381 if (
g.ActiveId != 0 &&
g.ActiveIdWindow &&
g.ActiveIdWindow->RootWindow != window)
6392 for (
int i =
g.Windows.Size - 1; i >= 0; i--)
6437 w =
ImMax(1.0
f, width_to_right_edge +
w);
6455 g.FontBaseSize =
g.IO.FontGlobalScale *
g.Font->
FontSize *
g.Font->Scale;
6456 g.FontSize =
g.CurrentWindow ?
g.CurrentWindow->CalcFontSize() : 0.0f;
6460 g.DrawListSharedData.Font =
g.Font;
6461 g.DrawListSharedData.FontSize =
g.FontSize;
6470 g.FontStack.push_back(font);
6478 g.FontStack.pop_back();
6540 g.ColorModifiers.push_back(backup);
6550 g.ColorModifiers.push_back(backup);
6551 g.Style.Colors[idx] = col;
6561 g.ColorModifiers.pop_back();
6611 float* pvar = (
float*)var_info->
GetVarPtr(&
g.Style);
6643 g.StyleModifiers.pop_back();
6707 while (window !=
NULL)
6709 if (window == potential_parent)
6723 if (
g.HoveredWindow ==
NULL)
6731 if (
g.HoveredRootWindow !=
g.CurrentWindow->RootWindow)
6735 if (
g.HoveredWindow !=
g.CurrentWindow->RootWindow)
6743 if (
g.HoveredWindow !=
g.CurrentWindow)
6752 if (
g.ActiveId != 0 && !
g.ActiveIdAllowOverlap &&
g.ActiveId !=
g.HoveredWindow->MoveId)
6763 return g.NavWindow !=
NULL;
6768 return g.NavWindow &&
g.NavWindow->RootWindow ==
g.CurrentWindow->RootWindow;
6770 return g.NavWindow ==
g.CurrentWindow->RootWindow;
6774 return g.NavWindow ==
g.CurrentWindow;
6788 return window->
Size.
x;
6794 return window->
Size.
y;
6807 window->
Scroll.
x = new_scroll_x;
6814 window->
Scroll.
y = new_scroll_y;
6849 return window->
Size;
6949 g.NextWindowData.PosPivotVal = pivot;
6964 g.NextWindowData.SizeConstraintRect =
ImRect(size_min, size_max);
6965 g.NextWindowData.SizeCallback = custom_callback;
6966 g.NextWindowData.SizeCallbackUserData = custom_callback_user_data;
7051 return g.
FontSize +
g.Style.FramePadding.y * 2.0f;
7057 return g.
FontSize +
g.Style.FramePadding.y * 2.0f +
g.Style.ItemSpacing.y;
7086 g.FontSize =
g.DrawListSharedData.FontSize = window->
CalcFontSize();
7187 IM_ASSERT(center_y_ratio >= 0.0
f && center_y_ratio <= 1.0
f);
7192 if (center_y_ratio <= 0.0f && window->ScrollTarget.y <= window->
WindowPadding.
y)
7229 g.NavInitRequest =
false;
7231 g.NavInitResultRectRel =
ImRect(
g.NavWindow->DC.LastItemRect.Min -
g.NavWindow->Pos,
g.NavWindow->DC.LastItemRect.Max -
g.NavWindow->Pos);
7264 va_start(args, fmt);
7279 va_start(args, fmt);
7294 va_start(args, fmt);
7310 va_start(args, fmt);
7323 const char* text_begin = text;
7324 if (text_end ==
NULL)
7325 text_end = text + strlen(text);
7329 const bool wrap_enabled = wrap_pos_x >= 0.0f;
7330 if (text_end - text > 2000 && !wrap_enabled)
7336 const char* line = text;
7341 if (text_pos.
y <= clip_rect.
Max.
y)
7348 int lines_skippable = (int)((clip_rect.
Min.
y - text_pos.
y) / line_height);
7349 if (lines_skippable > 0)
7351 int lines_skipped = 0;
7352 while (line < text_end && lines_skipped < lines_skippable)
7354 const char* line_end = strchr(line,
'\n');
7356 line_end = text_end;
7357 line = line_end + 1;
7360 pos.
y += lines_skipped * line_height;
7365 if (line < text_end)
7368 while (line < text_end)
7370 const char* line_end = strchr(line,
'\n');
7375 text_size.
x =
ImMax(text_size.
x, line_size.
x);
7378 line_end = text_end;
7379 line = line_end + 1;
7380 line_rect.
Min.
y += line_height;
7381 line_rect.
Max.
y += line_height;
7382 pos.
y += line_height;
7386 int lines_skipped = 0;
7387 while (line < text_end)
7389 const char* line_end = strchr(line,
'\n');
7391 line_end = text_end;
7392 line = line_end + 1;
7395 pos.
y += lines_skipped * line_height;
7398 text_size.
y += (pos - text_pos).
y;
7401 ImRect bb(text_pos, text_pos + text_size);
7411 ImRect bb(text_pos, text_pos + text_size);
7451 const char* value_text_begin = &
g.TempBuffer[0];
7454 if (label_size.
x > 0.0f)
7461 va_start(args, fmt);
7473 if (out_hovered) *out_hovered =
false;
7474 if (out_held) *out_held =
false;
7485 g.HoveredWindow = window;
7487 bool pressed =
false;
7504 g.HoveredWindow = backup_hovered_window;
7551 g.NavDisableHighlight =
true;
7556 if (
g.NavId ==
id && !
g.NavDisableHighlight &&
g.NavDisableMouseHover && (
g.ActiveId == 0 ||
g.ActiveId ==
id ||
g.ActiveId == window->
MoveId))
7559 if (
g.NavActivateDownId ==
id)
7561 bool nav_activated_by_code = (
g.NavActivateId ==
id);
7563 if (nav_activated_by_code || nav_activated_by_inputs)
7565 if (nav_activated_by_code || nav_activated_by_inputs ||
g.ActiveId ==
id)
7568 g.NavActivateId =
id;
7577 if (
g.ActiveId ==
id)
7581 if (
g.ActiveIdIsJustActivated)
7582 g.ActiveIdClickOffset =
g.IO.MousePos - bb.
Min;
7583 if (
g.IO.MouseDown[0])
7591 if (!
g.DragDropActive)
7596 g.NavDisableHighlight =
true;
7600 if (
g.NavActivateDownId !=
id)
7605 if (out_hovered) *out_hovered = hovered;
7606 if (out_held) *out_held = held;
7660 g.Style.FramePadding.y = 0.0f;
7662 g.Style.FramePadding.y = backup_padding_y;
7696 bool is_clipped = !
ItemAdd(bb,
id);
7708 const float cross_extent = (radius * 0.7071f) - 1.0
f;
7751 if (border_col.
w > 0.0f)
7757 if (border_col.
w > 0.0f)
7783 PushID((
void *)user_texture_id);
7787 const ImVec2 padding = (frame_padding >= 0) ?
ImVec2((
float)frame_padding, (float)frame_padding) : style.
FramePadding;
7801 if (bg_col.
w > 0.0f)
7818 g.LogEnabled =
true;
7821 g.LogAutoExpandMaxDepth = max_depth;
7834 filename =
g.IO.LogFilename;
7846 g.LogEnabled =
true;
7849 g.LogAutoExpandMaxDepth = max_depth;
7862 g.LogEnabled =
true;
7865 g.LogAutoExpandMaxDepth = max_depth;
7875 if (
g.LogFile !=
NULL)
7877 if (
g.LogFile == stdout)
7883 if (
g.LogClipboard->size() > 1)
7886 g.LogClipboard->clear();
7888 g.LogEnabled =
false;
7899 const bool log_to_clipboard =
Button(
"Log To Clipboard");
SameLine();
7911 LogToFile(
g.LogAutoExpandMaxDepth,
g.IO.LogFilename);
7912 if (log_to_clipboard)
7927 if (
g.NextTreeNodeOpenCond != 0)
7931 is_open =
g.NextTreeNodeOpenVal;
7932 storage->
SetInt(
id, is_open);
7937 const int stored_value = storage->
GetInt(
id, -1);
7938 if (stored_value == -1)
7940 is_open =
g.NextTreeNodeOpenVal;
7941 storage->
SetInt(
id, is_open);
7945 is_open = stored_value != 0;
7948 g.NextTreeNodeOpenCond = 0;
7989 const float text_offset_x = (
g.FontSize + (display_frame ? padding.
x*3 : padding.
x*2));
7990 const float text_width =
g.FontSize + (label_size.
x > 0.0f ? label_size.
x + padding.
x*2 : 0.0f);
8004 bool item_add =
ItemAdd(interact_bb,
id);
8026 bool hovered, held, pressed =
ButtonBehavior(interact_bb,
id, &hovered, &held, button_flags);
8029 bool toggled =
false;
8036 toggled |=
g.IO.MouseDoubleClicked[0];
8037 if (
g.DragDropActive && is_open)
8041 if (
g.NavId ==
id &&
g.NavMoveRequest &&
g.NavMoveDir ==
ImGuiDir_Left && is_open)
8046 if (
g.NavId ==
id &&
g.NavMoveRequest &&
g.NavMoveDir ==
ImGuiDir_Right && !is_open)
8063 const ImVec2 text_pos = frame_bb.
Min +
ImVec2(text_offset_x, text_base_offset_y);
8073 const char log_prefix[] =
"\n##";
8074 const char log_suffix[] =
"##";
8124 if (p_open && !*p_open)
8187 va_start(args, fmt);
8196 va_start(args, fmt);
8205 va_start(args, fmt);
8214 va_start(args, fmt);
8238 return g.
FontSize + (
g.Style.FramePadding.x * 2.0f);
8244 if (
g.CurrentWindow->SkipItems)
8270 const void* ptr_id = (
void*)(intptr_t)int_id;
8328 const char* text_begin =
g.TempBuffer;
8346 va_start(args, fmt);
8363 if (decimal_precision < 0)
8370 if (decimal_precision < 0)
8382 *(
int*)value1 = *(
int*)value1 + *(
const int*)value2;
8384 *(
int*)value1 = *(
int*)value1 - *(
const int*)value2;
8389 *(
float*)value1 = *(
float*)value1 + *(
const float*)value2;
8391 *(
float*)value1 = *(
float*)value1 - *(
const float*)value2;
8404 if (op ==
'+' || op ==
'*' || op ==
'/')
8420 scalar_format =
"%d";
8421 int*
v = (
int*)data_ptr;
8422 const int old_v = *
v;
8424 if (op && sscanf(initial_value_buf, scalar_format, &arg0i) < 1)
8429 if (op ==
'+') {
if (sscanf(
buf,
"%f", &arg1f) == 1) *
v = (
int)(arg0i + arg1f); }
8430 else if (op ==
'*') {
if (sscanf(
buf,
"%f", &arg1f) == 1) *
v = (
int)(arg0i * arg1f); }
8431 else if (op ==
'/') {
if (sscanf(
buf,
"%f", &arg1f) == 1 && arg1f != 0.0f) *
v = (
int)(arg0i / arg1f); }
8432 else {
if (sscanf(
buf, scalar_format, &arg0i) == 1) *
v = arg0i; }
8433 return (old_v != *
v);
8438 scalar_format =
"%f";
8439 float*
v = (
float*)data_ptr;
8440 const float old_v = *
v;
8442 if (op && sscanf(initial_value_buf, scalar_format, &arg0f) < 1)
8446 if (sscanf(
buf, scalar_format, &arg1f) < 1)
8448 if (op ==
'+') { *
v = arg0f + arg1f; }
8449 else if (op ==
'*') { *
v = arg0f * arg1f; }
8450 else if (op ==
'/') {
if (arg1f != 0.0
f) *
v = arg0f / arg1f; }
8451 else { *
v = arg1f; }
8452 return (old_v != *
v);
8475 if (
g.ScalarAsInputTextId == 0)
8478 g.ScalarAsInputTextId =
g.ActiveId;
8481 if (text_value_changed)
8490 while ((fmt = strchr(fmt,
'%')) !=
NULL)
8493 if (fmt[0] ==
'%') { fmt++;
continue; }
8494 while (*fmt >=
'0' && *fmt <=
'9')
8502 if (*fmt ==
'e' || *fmt ==
'E')
8511 static const float min_steps[10] = { 1.0f, 0.1f, 0.01f, 0.001f, 0.0001f, 0.00001f, 0.000001f, 0.0000001f, 0.00000001f, 0.000000001f };
8512 return (decimal_precision >= 0 && decimal_precision < 10) ? min_steps[decimal_precision] : powf(10.0
f, (
float)-decimal_precision);
8520 if (decimal_precision < 0)
8523 bool negative =
value < 0.0f;
8525 float remainder = fmodf(
value, min_step);
8526 if (remainder <= min_step*0.5
f)
8529 value += (min_step - remainder);
8538 const bool is_non_linear = (power < 1.0f-0.00001f) || (power > 1.0
f+0.00001
f);
8539 const float v_clamped = (v_min < v_max) ?
ImClamp(
v, v_min, v_max) :
ImClamp(
v, v_max, v_min);
8542 if (v_clamped < 0.0
f)
8544 const float f = 1.0f - (v_clamped - v_min) / (
ImMin(0.0
f,v_max) - v_min);
8545 return (1.0
f - powf(
f, 1.0
f/power)) * linear_zero_pos;
8549 const float f = (v_clamped -
ImMax(0.0
f,v_min)) / (v_max -
ImMax(0.0
f,v_min));
8550 return linear_zero_pos + powf(
f, 1.0
f/power) * (1.0f - linear_zero_pos);
8555 return (v_clamped - v_min) / (v_max - v_min);
8569 const bool is_non_linear = (power < 1.0f-0.00001f) || (power > 1.0
f+0.00001
f);
8572 const float grab_padding = 2.0f;
8573 const float slider_sz = is_horizontal ? (frame_bb.
GetWidth() - grab_padding * 2.0f) : (frame_bb.
GetHeight() - grab_padding * 2.0f);
8575 if (decimal_precision != 0)
8578 grab_sz =
ImMin(
ImMax(1.0
f * (slider_sz / ((v_min < v_max ? v_max - v_min : v_min - v_max) + 1.0
f)), style.
GrabMinSize), slider_sz);
8579 const float slider_usable_sz = slider_sz - grab_sz;
8580 const float slider_usable_pos_min = (is_horizontal ? frame_bb.
Min.
x : frame_bb.
Min.
y) + grab_padding + grab_sz*0.5
f;
8581 const float slider_usable_pos_max = (is_horizontal ? frame_bb.
Max.
x : frame_bb.
Max.
y) - grab_padding - grab_sz*0.5
f;
8584 float linear_zero_pos = 0.0f;
8585 if (v_min * v_max < 0.0
f)
8588 const float linear_dist_min_to_0 = powf(fabsf(0.0
f - v_min), 1.0
f/power);
8589 const float linear_dist_max_to_0 = powf(fabsf(v_max - 0.0
f), 1.0
f/power);
8590 linear_zero_pos = linear_dist_min_to_0 / (linear_dist_min_to_0+linear_dist_max_to_0);
8595 linear_zero_pos = v_min < 0.0f ? 1.0f : 0.0f;
8599 bool value_changed =
false;
8600 if (
g.ActiveId ==
id)
8602 bool set_new_value =
false;
8603 float clicked_t = 0.0f;
8606 if (!
g.IO.MouseDown[0])
8612 const float mouse_abs_pos = is_horizontal ?
g.IO.MousePos.x :
g.IO.MousePos.y;
8613 clicked_t = (slider_usable_sz > 0.0f) ?
ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0
f;
8615 clicked_t = 1.0f - clicked_t;
8616 set_new_value =
true;
8622 float delta = is_horizontal ? delta2.
x : -delta2.
y;
8623 if (
g.NavActivatePressedId ==
id && !
g.ActiveIdIsJustActivated)
8627 else if (delta != 0.0
f)
8630 if (decimal_precision == 0 && !is_non_linear)
8633 delta = ((delta < 0.0f) ? -1.0
f : +1.0
f) / (v_max - v_min);
8645 set_new_value =
true;
8646 if ((clicked_t >= 1.0
f && delta > 0.0
f) || (clicked_t <= 0.0f && delta < 0.0f))
8647 set_new_value =
false;
8659 if (clicked_t < linear_zero_pos)
8662 float a = 1.0f - (clicked_t / linear_zero_pos);
8670 if (fabsf(linear_zero_pos - 1.0
f) > 1.e-6
f)
8671 a = (clicked_t - linear_zero_pos) / (1.0
f - linear_zero_pos);
8681 new_value =
ImLerp(v_min, v_max, clicked_t);
8685 new_value =
RoundScalar(new_value, decimal_precision);
8686 if (*
v != new_value)
8689 value_changed =
true;
8697 grab_t = 1.0f - grab_t;
8698 const float grab_pos =
ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t);
8701 grab_bb =
ImRect(
ImVec2(grab_pos - grab_sz*0.5
f, frame_bb.
Min.
y + grab_padding),
ImVec2(grab_pos + grab_sz*0.5
f, frame_bb.
Max.
y - grab_padding));
8703 grab_bb =
ImRect(
ImVec2(frame_bb.
Min.
x + grab_padding, grab_pos - grab_sz*0.5f),
ImVec2(frame_bb.
Max.
x - grab_padding, grab_pos + grab_sz*0.5f));
8706 return value_changed;
8730 if (!
ItemAdd(total_bb,
id, &frame_bb))
8737 if (!display_format)
8738 display_format =
"%.3f";
8742 bool start_text_input =
false;
8744 if (tab_focus_requested || (hovered &&
g.IO.MouseClicked[0]) ||
g.NavActivateId ==
id || (
g.NavInputId ==
id &&
g.ScalarAsInputTextId !=
id))
8750 if (tab_focus_requested ||
g.IO.KeyCtrl ||
g.NavInputId ==
id)
8752 start_text_input =
true;
8753 g.ScalarAsInputTextId = 0;
8756 if (start_text_input || (
g.ActiveId ==
id &&
g.ScalarAsInputTextId ==
id))
8761 const bool value_changed =
SliderBehavior(frame_bb,
id,
v, v_min, v_max, power, decimal_precision);
8768 if (label_size.
x > 0.0f)
8771 return value_changed;
8793 if (!display_format)
8794 display_format =
"%.3f";
8797 if ((hovered &&
g.IO.MouseClicked[0]) ||
g.NavActivateId ==
id ||
g.NavInputId ==
id)
8813 if (label_size.
x > 0.0f)
8816 return value_changed;
8821 float v_deg = (*v_rad) * 360.0f / (2*
IM_PI);
8822 bool value_changed =
SliderFloat(
label, &v_deg, v_degrees_min, v_degrees_max,
"%.0f deg", 1.0
f);
8823 *v_rad = v_deg * (2*
IM_PI) / 360.0
f;
8824 return value_changed;
8829 if (!display_format)
8830 display_format =
"%.0f";
8831 float v_f = (float)*
v;
8832 bool value_changed =
SliderFloat(
label, &v_f, (
float)v_min, (
float)v_max, display_format, 1.0
f);
8834 return value_changed;
8839 if (!display_format)
8840 display_format =
"%.0f";
8841 float v_f = (float)*
v;
8844 return value_changed;
8855 bool value_changed =
false;
8862 value_changed |=
SliderFloat(
"##v", &
v[i], v_min, v_max, display_format, power);
8863 SameLine(0,
g.Style.ItemInnerSpacing.x);
8872 return value_changed;
8897 bool value_changed =
false;
8904 value_changed |=
SliderInt(
"##v", &
v[i], v_min, v_max, display_format);
8905 SameLine(0,
g.Style.ItemInnerSpacing.x);
8914 return value_changed;
8942 bool value_changed =
false;
8945 if (
g.ActiveId ==
id)
8949 else if (
g.ActiveIdSource ==
ImGuiInputSource_Nav &&
g.NavActivatePressedId ==
id && !
g.ActiveIdIsJustActivated)
8952 if (
g.ActiveId ==
id)
8954 if (
g.ActiveIdIsJustActivated)
8957 g.DragCurrentValue = *
v;
8958 g.DragLastMouseDelta =
ImVec2(0.
f, 0.
f);
8961 if (v_speed == 0.0
f && (v_max - v_min) != 0.0
f && (v_max - v_min) <
FLT_MAX)
8962 v_speed = (v_max - v_min) *
g.DragSpeedDefaultRatio;
8964 float v_cur =
g.DragCurrentValue;
8966 float adjust_delta = 0.0f;
8969 adjust_delta = mouse_drag_delta.
x -
g.DragLastMouseDelta.x;
8970 if (
g.IO.KeyShift &&
g.DragSpeedScaleFast >= 0.0f)
8971 adjust_delta *=
g.DragSpeedScaleFast;
8972 if (
g.IO.KeyAlt &&
g.DragSpeedScaleSlow >= 0.0f)
8973 adjust_delta *=
g.DragSpeedScaleSlow;
8974 g.DragLastMouseDelta.x = mouse_drag_delta.x;
8979 if (v_min < v_max && ((v_cur >= v_max && adjust_delta > 0.0
f) || (v_cur <= v_min && adjust_delta < 0.0
f)))
8980 adjust_delta = 0.0f;
8983 adjust_delta *= v_speed;
8985 if (fabsf(adjust_delta) > 0.0
f)
8987 if (fabsf(power - 1.0
f) > 0.001
f)
8990 float v0_abs = v_cur >= 0.0f ? v_cur : -v_cur;
8991 float v0_sign = v_cur >= 0.0f ? 1.0f : -1.0f;
8992 float v1 = powf(v0_abs, 1.0
f / power) + (adjust_delta * v0_sign);
8993 float v1_abs =
v1 >= 0.0f ?
v1 : -
v1;
8994 float v1_sign =
v1 >= 0.0f ? 1.0f : -1.0f;
8995 v_cur = powf(v1_abs, power) * v0_sign * v1_sign;
8999 v_cur += adjust_delta;
9004 v_cur =
ImClamp(v_cur, v_min, v_max);
9005 g.DragCurrentValue = v_cur;
9013 value_changed =
true;
9017 return value_changed;
9020 bool ImGui::DragFloat(
const char*
label,
float*
v,
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
9037 if (!
ItemAdd(total_bb,
id, &frame_bb))
9044 if (!display_format)
9045 display_format =
"%.3f";
9049 bool start_text_input =
false;
9051 if (tab_focus_requested || (hovered && (
g.IO.MouseClicked[0] ||
g.IO.MouseDoubleClicked[0])) ||
g.NavActivateId ==
id || (
g.NavInputId ==
id &&
g.ScalarAsInputTextId !=
id))
9057 if (tab_focus_requested ||
g.IO.KeyCtrl ||
g.IO.MouseDoubleClicked[0] ||
g.NavInputId ==
id)
9059 start_text_input =
true;
9060 g.ScalarAsInputTextId = 0;
9063 if (start_text_input || (
g.ActiveId ==
id &&
g.ScalarAsInputTextId ==
id))
9068 const bool value_changed =
DragBehavior(frame_bb,
id,
v, v_speed, v_min, v_max, decimal_precision, power);
9075 if (label_size.
x > 0.0f)
9078 return value_changed;
9088 bool value_changed =
false;
9095 value_changed |=
DragFloat(
"##v", &
v[i], v_speed, v_min, v_max, display_format, power);
9096 SameLine(0,
g.Style.ItemInnerSpacing.x);
9105 return value_changed;
9108 bool ImGui::DragFloat2(
const char*
label,
float v[2],
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
9110 return DragFloatN(
label,
v, 2, v_speed, v_min, v_max, display_format, power);
9113 bool ImGui::DragFloat3(
const char*
label,
float v[3],
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
9115 return DragFloatN(
label,
v, 3, v_speed, v_min, v_max, display_format, power);
9118 bool ImGui::DragFloat4(
const char*
label,
float v[4],
float v_speed,
float v_min,
float v_max,
const char* display_format,
float power)
9120 return DragFloatN(
label,
v, 4, v_speed, v_min, v_max, display_format, power);
9123 bool ImGui::DragFloatRange2(
const char*
label,
float* v_current_min,
float* v_current_max,
float v_speed,
float v_min,
float v_max,
const char* display_format,
const char* display_format_max,
float power)
9134 bool value_changed =
DragFloat(
"##min", v_current_min, v_speed, (v_min >= v_max) ? -
FLT_MAX : v_min, (v_min >= v_max) ? *v_current_max :
ImMin(v_max, *v_current_max), display_format, power);
9136 SameLine(0,
g.Style.ItemInnerSpacing.x);
9137 value_changed |=
DragFloat(
"##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min :
ImMax(v_min, *v_current_min), (v_min >= v_max) ?
FLT_MAX : v_max, display_format_max ? display_format_max : display_format, power);
9139 SameLine(0,
g.Style.ItemInnerSpacing.x);
9145 return value_changed;
9151 if (!display_format)
9152 display_format =
"%.0f";
9153 float v_f = (float)*
v;
9154 bool value_changed =
DragFloat(
label, &v_f, v_speed, (
float)v_min, (
float)v_max, display_format);
9156 return value_changed;
9166 bool value_changed =
false;
9173 value_changed |=
DragInt(
"##v", &
v[i], v_speed, v_min, v_max, display_format);
9174 SameLine(0,
g.Style.ItemInnerSpacing.x);
9183 return value_changed;
9188 return DragIntN(
label,
v, 2, v_speed, v_min, v_max, display_format);
9193 return DragIntN(
label,
v, 3, v_speed, v_min, v_max, display_format);
9198 return DragIntN(
label,
v, 4, v_speed, v_min, v_max, display_format);
9201 bool ImGui::DragIntRange2(
const char*
label,
int* v_current_min,
int* v_current_max,
float v_speed,
int v_min,
int v_max,
const char* display_format,
const char* display_format_max)
9212 bool value_changed =
DragInt(
"##min", v_current_min, v_speed, (v_min >= v_max) ? INT_MIN : v_min, (v_min >= v_max) ? *v_current_max :
ImMin(v_max, *v_current_max), display_format);
9214 SameLine(0,
g.Style.ItemInnerSpacing.x);
9215 value_changed |=
DragInt(
"##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min :
ImMax(v_min, *v_current_min), (v_min >= v_max) ? INT_MAX : v_max, display_format_max ? display_format_max : display_format);
9217 SameLine(0,
g.Style.ItemInnerSpacing.x);
9223 return value_changed;
9226 void ImGui::PlotEx(
ImGuiPlotType plot_type,
const char*
label,
float (*values_getter)(
void*
data,
int idx),
void*
data,
int values_count,
int values_offset,
const char* overlay_text,
float scale_min,
float scale_max,
ImVec2 graph_size)
9236 if (graph_size.
x == 0.0f)
9238 if (graph_size.
y == 0.0f)
9245 if (!
ItemAdd(total_bb, 0, &frame_bb))
9254 for (
int i = 0; i < values_count; i++)
9256 const float v = values_getter(
data, i);
9268 if (values_count > 0)
9277 const float t =
ImClamp((
g.IO.MousePos.x - inner_bb.
Min.
x) / (inner_bb.
Max.
x - inner_bb.
Min.
x), 0.0f, 0.9999f);
9278 const int v_idx = (int)(
t * item_count);
9279 IM_ASSERT(v_idx >= 0 && v_idx < values_count);
9281 const float v0 = values_getter(
data, (v_idx + values_offset) % values_count);
9282 const float v1 = values_getter(
data, (v_idx + 1 + values_offset) % values_count);
9290 const float t_step = 1.0f / (float)res_w;
9291 const float inv_scale = (scale_min == scale_max) ? 0.0
f : (1.0
f / (scale_max - scale_min));
9293 float v0 = values_getter(
data, (0 + values_offset) % values_count);
9296 float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min * inv_scale) : (scale_min < 0.0f ? 0.0f : 1.0f);
9301 for (
int n = 0;
n < res_w;
n++)
9303 const float t1 =
t0 + t_step;
9304 const int v1_idx = (int)(
t0 * item_count + 0.5
f);
9305 IM_ASSERT(v1_idx >= 0 && v1_idx < values_count);
9306 const float v1 = values_getter(
data, (v1_idx + values_offset + 1) % values_count);
9314 window->
DrawList->
AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base);
9318 if (pos1.
x >= pos0.
x + 2.0f)
9332 if (label_size.
x > 0.0f)
9347 const float v = *(
float*)(
void*)((
unsigned char*)plot_data->
Values + (
size_t)idx * plot_data->
Stride);
9357 void ImGui::PlotLines(
const char*
label,
float (*values_getter)(
void*
data,
int idx),
void*
data,
int values_count,
int values_offset,
const char* overlay_text,
float scale_min,
float scale_max,
ImVec2 graph_size)
9368 void ImGui::PlotHistogram(
const char*
label,
float (*values_getter)(
void*
data,
int idx),
void*
data,
int values_count,
int values_offset,
const char* overlay_text,
float scale_min,
float scale_max,
ImVec2 graph_size)
9397 char overlay_buf[32];
9401 overlay = overlay_buf;
9405 if (overlay_size.
x > 0.0f)
9406 RenderTextClipped(
ImVec2(
ImClamp(fill_br.
x + style.
ItemSpacing.
x, bb.
Min.
x, bb.
Max.
x - overlay_size.
x - style.
ItemInnerSpacing.
x), bb.
Min.
y), bb.
Max, overlay,
NULL, &overlay_size,
ImVec2(0.0
f,0.5
f), &bb);
9423 ImRect total_bb = check_bb;
9424 if (label_size.
x > 0)
9427 if (label_size.
x > 0)
9446 const float pad =
ImMax(1.0
f, (
float)(
int)(check_sz / 6.0
f));
9452 if (label_size.
x > 0.0f)
9460 bool v = ((*
flags & flags_value) == flags_value);
9465 *
flags |= flags_value;
9467 *
flags &= ~flags_value;
9487 ImRect total_bb = check_bb;
9488 if (label_size.
x > 0)
9491 if (label_size.
x > 0)
9494 total_bb.
Add(text_bb);
9501 center.
x = (float)(
int)center.
x + 0.5f;
9502 center.
y = (float)(
int)center.
y + 0.5f;
9503 const float radius = check_bb.
GetHeight() * 0.5f;
9513 const float pad =
ImMax(1.0
f, (
float)(
int)(check_sz / 6.0
f));
9525 if (label_size.
x > 0.0f)
9544 const char*
s = text_begin;
9545 while (
char c = *
s++)
9549 if (
s[0] !=
'\n' &&
s[0] !=
'\r')
9562 float line_width = 0.0f;
9565 while (
s < text_end)
9567 unsigned int c = (
unsigned int)(*
s++);
9570 text_size.
x =
ImMax(text_size.
x, line_width);
9571 text_size.
y += line_height;
9573 if (stop_on_new_line)
9581 line_width += char_width;
9584 if (text_size.
x < line_width)
9585 text_size.
x = line_width;
9588 *out_offset =
ImVec2(line_width, text_size.
y + line_height);
9590 if (line_width > 0 || text_size.
y == 0.0f)
9591 text_size.
y += line_height;
9615 r->baseline_y_delta =
size.y;
9618 r->num_chars = (int)(text_remaining - (text + line_start_idx));
9624 #ifdef __APPLE__ // FIXME: Move setting to IO structure 9630 #define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h 9631 #define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL 9650 const int text_len =
obj->CurLenW;
9652 if (new_text_len + text_len + 1 >
obj->Text.Size)
9656 if (new_text_len_utf8 +
obj->CurLenA + 1 >
obj->BufSizeA)
9660 if (pos != text_len)
9661 memmove(text + pos + new_text_len, text + pos, (
size_t)(text_len - pos) *
sizeof(
ImWchar));
9662 memcpy(text + pos, new_text, (
size_t)new_text_len *
sizeof(
ImWchar));
9664 obj->CurLenW += new_text_len;
9665 obj->CurLenA += new_text_len_utf8;
9666 obj->Text[
obj->CurLenW] =
'\0';
9672 #define STB_TEXTEDIT_K_LEFT 0x10000 // keyboard input to move cursor left 9673 #define STB_TEXTEDIT_K_RIGHT 0x10001 // keyboard input to move cursor right 9674 #define STB_TEXTEDIT_K_UP 0x10002 // keyboard input to move cursor up 9675 #define STB_TEXTEDIT_K_DOWN 0x10003 // keyboard input to move cursor down 9676 #define STB_TEXTEDIT_K_LINESTART 0x10004 // keyboard input to move cursor to start of line 9677 #define STB_TEXTEDIT_K_LINEEND 0x10005 // keyboard input to move cursor to end of line 9678 #define STB_TEXTEDIT_K_TEXTSTART 0x10006 // keyboard input to move cursor to start of text 9679 #define STB_TEXTEDIT_K_TEXTEND 0x10007 // keyboard input to move cursor to end of text 9680 #define STB_TEXTEDIT_K_DELETE 0x10008 // keyboard input to delete selection or character under cursor 9681 #define STB_TEXTEDIT_K_BACKSPACE 0x10009 // keyboard input to delete selection or character left of cursor 9682 #define STB_TEXTEDIT_K_UNDO 0x1000A // keyboard input to perform undo 9683 #define STB_TEXTEDIT_K_REDO 0x1000B // keyboard input to perform redo 9684 #define STB_TEXTEDIT_K_WORDLEFT 0x1000C // keyboard input to move cursor left one word 9685 #define STB_TEXTEDIT_K_WORDRIGHT 0x1000D // keyboard input to move cursor right one word 9686 #define STB_TEXTEDIT_K_SHIFT 0x20000 9688 #define STB_TEXTEDIT_IMPLEMENTATION 9695 stb_textedit_key(
this, &StbState,
key);
9696 CursorFollow =
true;
9705 IM_ASSERT(pos + bytes_count <= BufTextLen);
9706 char*
dst = Buf + pos;
9707 const char*
src = Buf + pos + bytes_count;
9708 while (
char c = *
src++)
9712 if (CursorPos + bytes_count >= pos)
9713 CursorPos -= bytes_count;
9714 else if (CursorPos >= pos)
9716 SelectionStart = SelectionEnd = CursorPos;
9718 BufTextLen -= bytes_count;
9723 const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)strlen(new_text);
9724 if (new_text_len + BufTextLen + 1 >= BufSize)
9727 if (BufTextLen != pos)
9728 memmove(Buf + pos + new_text_len, Buf + pos, (
size_t)(BufTextLen - pos));
9729 memcpy(Buf + pos, new_text, (
size_t)new_text_len *
sizeof(
char));
9730 Buf[BufTextLen + new_text_len] =
'\0';
9732 if (CursorPos >= pos)
9733 CursorPos += new_text_len;
9734 SelectionStart = SelectionEnd = CursorPos;
9736 BufTextLen += new_text_len;
9742 unsigned int c = *p_char;
9744 if (
c < 128 &&
c !=
' ' && !isprint((
int)(
c & 0xFF)))
9753 if (
c >= 0xE000 &&
c <= 0xF8FF)
9759 if (!(
c >=
'0' &&
c <=
'9') && (
c !=
'.') && (
c !=
'-') && (
c !=
'+') && (
c !=
'*') && (
c !=
'/'))
9767 if (
c >=
'a' &&
c <=
'z')
9768 *p_char = (
c += (
unsigned int)(
'A'-
'a'));
9782 callback_data.
UserData = user_data;
9783 if (callback(&callback_data) != 0)
9825 ItemAdd(total_bb,
id, &frame_bb);
9838 if (!
ItemAdd(total_bb,
id, &frame_bb))
9849 ImFont* password_font = &
g.InputTextPasswordFont;
9850 password_font->
FontSize =
g.Font->FontSize;
9851 password_font->
Scale =
g.Font->Scale;
9853 password_font->
Ascent =
g.Font->Ascent;
9854 password_font->
Descent =
g.Font->Descent;
9867 const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code;
9869 const bool user_clicked = hovered && io.
MouseClicked[0];
9870 const bool user_scrolled = is_multiline &&
g.ActiveId == 0 && edit_state.
Id ==
id &&
g.ActiveIdPreviousFrame == draw_window->
GetIDNoKeepAlive(
"#SCROLLY");
9872 bool clear_active_id =
false;
9875 if (focus_requested || user_clicked || user_scrolled ||
g.NavInputId ==
id)
9877 if (
g.ActiveId !=
id)
9882 const int prev_len_w = edit_state.
CurLenW;
9886 const char* buf_end =
NULL;
9893 const bool recycle_state = (edit_state.
Id ==
id) && (prev_len_w == edit_state.
CurLenW);
9904 stb_textedit_initialize_state(&edit_state.
StbState, !is_multiline);
9905 if (!is_multiline && focus_requested_by_code)
9909 edit_state.
StbState.insert_mode =
true;
9910 if (!is_multiline && (focus_requested_by_tab || (user_clicked && io.
KeyCtrl)))
9922 clear_active_id =
true;
9925 bool value_changed =
false;
9926 bool enter_pressed =
false;
9928 if (
g.ActiveId ==
id)
9930 if (!is_editable && !
g.ActiveIdIsJustActivated)
9934 const char* buf_end =
NULL;
9945 g.WantTextInputNextFrame = 1;
9952 if (select_all || (hovered && !osx_double_click_selects_words && io.
MouseDoubleClicked[0]))
9967 stb_textedit_click(&edit_state, &edit_state.
StbState, mouse_x, mouse_y);
9973 stb_textedit_drag(&edit_state, &edit_state.
StbState, mouse_x, mouse_y);
9997 memset(
g.IO.InputCharacters, 0,
sizeof(
g.IO.InputCharacters));
10001 bool cancel_edit =
false;
10002 if (
g.ActiveId ==
id && !
g.ActiveIdIsJustActivated && !clear_active_id)
10035 if (!is_multiline || (ctrl_enter_for_new_line && !io.
KeyCtrl) || (!ctrl_enter_for_new_line && io.
KeyCtrl))
10037 enter_pressed = clear_active_id =
true;
10039 else if (is_editable)
10041 unsigned int c =
'\n';
10048 unsigned int c =
'\t';
10056 else if (is_cut || is_copy)
10073 stb_textedit_cut(&edit_state, &edit_state.
StbState);
10082 const int clipboard_len = (int)strlen(clipboard);
10084 int clipboard_filtered_len = 0;
10085 for (
const char*
s = clipboard; *
s; )
10093 clipboard_filtered[clipboard_filtered_len++] = (
ImWchar)
c;
10095 clipboard_filtered[clipboard_filtered_len] = 0;
10096 if (clipboard_filtered_len > 0)
10098 stb_textedit_paste(&edit_state, &edit_state.
StbState, clipboard_filtered, clipboard_filtered_len);
10106 if (
g.ActiveId ==
id)
10114 value_changed =
true;
10121 if (apply_edit_back_to_user_buffer)
10165 callback_data.
UserData = user_data;
10166 callback_data.
ReadOnly = !is_editable;
10168 callback_data.
EventKey = event_key;
10181 callback(&callback_data);
10204 value_changed =
true;
10210 if (clear_active_id &&
g.ActiveId ==
id)
10224 const bool is_currently_scrolling = (edit_state.
Id ==
id && is_multiline &&
g.ActiveId == draw_window->
GetIDNoKeepAlive(
"#SCROLLY"));
10225 if (
g.ActiveId ==
id || is_currently_scrolling)
10236 ImVec2 cursor_offset, select_start_offset;
10240 const ImWchar* searches_input_ptr[2];
10241 searches_input_ptr[0] = text_begin + edit_state.
StbState.cursor;
10242 searches_input_ptr[1] =
NULL;
10243 int searches_remaining = 1;
10244 int searches_result_line_number[2] = { -1, -999 };
10247 searches_input_ptr[1] = text_begin +
ImMin(edit_state.
StbState.select_start, edit_state.
StbState.select_end);
10248 searches_result_line_number[1] = -1;
10249 searches_remaining++;
10254 searches_remaining += is_multiline ? 1 : 0;
10255 int line_count = 0;
10256 for (
const ImWchar*
s = text_begin; *
s != 0;
s++)
10260 if (searches_result_line_number[0] == -1 &&
s >= searches_input_ptr[0]) { searches_result_line_number[0] = line_count;
if (--searches_remaining <= 0)
break; }
10261 if (searches_result_line_number[1] == -1 &&
s >= searches_input_ptr[1]) { searches_result_line_number[1] = line_count;
if (--searches_remaining <= 0)
break; }
10264 if (searches_result_line_number[0] == -1) searches_result_line_number[0] = line_count;
10265 if (searches_result_line_number[1] == -1) searches_result_line_number[1] = line_count;
10269 cursor_offset.
y = searches_result_line_number[0] *
g.FontSize;
10270 if (searches_result_line_number[1] >= 0)
10273 select_start_offset.
y = searches_result_line_number[1] *
g.FontSize;
10278 text_size =
ImVec2(
size.x, line_count *
g.FontSize);
10287 const float scroll_increment_x =
size.x * 0.25f;
10288 if (cursor_offset.
x < edit_state.
ScrollX)
10289 edit_state.
ScrollX = (float)(
int)
ImMax(0.0
f, cursor_offset.
x - scroll_increment_x);
10290 else if (cursor_offset.
x -
size.x >= edit_state.
ScrollX)
10291 edit_state.
ScrollX = (float)(
int)(cursor_offset.
x -
size.x + scroll_increment_x);
10301 float scroll_y = draw_window->
Scroll.
y;
10302 if (cursor_offset.
y -
g.FontSize < scroll_y)
10303 scroll_y =
ImMax(0.0
f, cursor_offset.
y -
g.FontSize);
10304 else if (cursor_offset.
y -
size.y >= scroll_y)
10305 scroll_y = cursor_offset.
y -
size.y;
10307 draw_window->
Scroll.
y = scroll_y;
10320 float bg_offy_up = is_multiline ? 0.0f : -1.0f;
10321 float bg_offy_dn = is_multiline ? 0.0f : 2.0f;
10323 ImVec2 rect_pos = render_pos + select_start_offset - render_scroll;
10324 for (
const ImWchar*
p = text_selected_begin;
p < text_selected_end; )
10326 if (rect_pos.
y > clip_rect.
w +
g.FontSize)
10328 if (rect_pos.
y < clip_rect.
y)
10330 while (
p < text_selected_end)
10337 if (rect_size.
x <= 0.0f) rect_size.
x = (float)(
int)(
g.Font->GetCharAdvance((
unsigned short)
' ') * 0.50f);
10338 ImRect rect(rect_pos +
ImVec2(0.0
f, bg_offy_up -
g.FontSize), rect_pos +
ImVec2(rect_size.
x, bg_offy_dn));
10343 rect_pos.
x = render_pos.
x - render_scroll.x;
10344 rect_pos.
y +=
g.FontSize;
10351 bool cursor_is_visible = (!
g.IO.OptCursorBlink) || (
g.InputTextState.CursorAnim <= 0.0f) || fmodf(
g.InputTextState.CursorAnim, 1.20f) <= 0.80f;
10352 ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
10353 ImRect cursor_screen_rect(cursor_screen_pos.
x, cursor_screen_pos.
y-
g.FontSize+0.5f, cursor_screen_pos.
x+1.0f, cursor_screen_pos.
y-1.5f);
10354 if (cursor_is_visible && cursor_screen_rect.
Overlaps(clip_rect))
10359 g.OsImePosRequest =
ImVec2(cursor_screen_pos.
x - 1, cursor_screen_pos.
y -
g.FontSize);
10364 const char* buf_end =
NULL;
10381 if (
g.LogEnabled && !is_password)
10384 if (label_size.
x > 0)
10388 return enter_pressed;
10390 return value_changed;
10424 bool value_changed =
false;
10438 DataTypeApplyOp(data_type,
'-', data_ptr,
g.IO.KeyCtrl && step_fast_ptr ? step_fast_ptr : step_ptr);
10439 value_changed =
true;
10444 DataTypeApplyOp(data_type,
'+', data_ptr,
g.IO.KeyCtrl && step_fast_ptr ? step_fast_ptr : step_ptr);
10445 value_changed =
true;
10450 if (label_size.
x > 0)
10458 return value_changed;
10463 char display_format[16];
10464 if (decimal_precision < 0)
10465 strcpy(display_format,
"%f");
10485 bool value_changed =
false;
10492 value_changed |=
InputFloat(
"##v", &
v[i], 0, 0, decimal_precision, extra_flags);
10493 SameLine(0,
g.Style.ItemInnerSpacing.x);
10502 return value_changed;
10527 bool value_changed =
false;
10534 value_changed |=
InputInt(
"##v", &
v[i], 0, 0, extra_flags);
10535 SameLine(0,
g.Style.ItemInnerSpacing.x);
10544 return value_changed;
10565 if (items_count <= 0)
10567 return (
g.FontSize +
g.Style.ItemSpacing.y) * items_count -
g.Style.ItemSpacing.y + (
g.Style.WindowPadding.y * 2);
10575 g.NextWindowData.SizeConstraintCond = 0;
10589 if (!
ItemAdd(total_bb,
id, &frame_bb))
10592 bool hovered, held;
10602 if (preview_value !=
NULL)
10604 if (label_size.
x > 0)
10607 if ((pressed ||
g.NavActivateId ==
id) && !popup_open)
10618 if (backup_next_window_size_constraint)
10620 g.NextWindowData.SizeConstraintCond = backup_next_window_size_constraint;
10621 g.NextWindowData.SizeConstraintRect.Min.x =
ImMax(
g.NextWindowData.SizeConstraintRect.Min.x,
w);
10628 int popup_max_height_in_items = -1;
10640 if (popup_window->WasActive)
10674 bool ImGui::Combo(
const char*
label,
int* current_item,
bool (*items_getter)(
void*,
int,
const char**),
void*
data,
int items_count,
int popup_max_height_in_items)
10678 const char* preview_text =
NULL;
10679 if (*current_item >= 0 && *current_item < items_count)
10680 items_getter(
data, *current_item, &preview_text);
10683 if (popup_max_height_in_items != -1 && !
g.NextWindowData.SizeConstraintCond)
10694 bool value_changed =
false;
10695 for (
int i = 0; i < items_count; i++)
10697 PushID((
void*)(intptr_t)i);
10698 const bool item_selected = (i == *current_item);
10699 const char* item_text;
10700 if (!items_getter(
data, i, &item_text))
10701 item_text =
"*Unknown item*";
10704 value_changed =
true;
10713 return value_changed;
10718 const char*
const* items = (
const char*
const*)
data;
10720 *out_text = items[idx];
10727 const char* items_separated_by_zeros = (
const char*)
data;
10728 int items_count = 0;
10729 const char*
p = items_separated_by_zeros;
10732 if (idx == items_count)
10734 p += strlen(
p) + 1;
10745 bool ImGui::Combo(
const char*
label,
int* current_item,
const char*
const items[],
int items_count,
int height_in_items)
10748 return value_changed;
10752 bool ImGui::Combo(
const char*
label,
int* current_item,
const char* items_separated_by_zeros,
int height_in_items)
10754 int items_count = 0;
10755 const char*
p = items_separated_by_zeros;
10758 p += strlen(
p) + 1;
10762 return value_changed;
10781 ImVec2 size(size_arg.
x != 0.0f ? size_arg.
x : label_size.
x, size_arg.
y != 0.0f ? size_arg.
y : label_size.
y);
10792 ImRect bb_with_spacing(pos, pos + size_draw);
10794 bb_with_spacing.
Max.
x += window_padding.
x;
10797 float spacing_L = (float)(
int)(style.
ItemSpacing.
x * 0.5f);
10798 float spacing_U = (float)(
int)(style.
ItemSpacing.
y * 0.5f);
10801 bb_with_spacing.
Min.
x -= spacing_L;
10802 bb_with_spacing.
Min.
y -= spacing_U;
10803 bb_with_spacing.
Max.
x += spacing_R;
10804 bb_with_spacing.
Max.
y += spacing_D;
10817 bool hovered, held;
10818 bool pressed =
ButtonBehavior(bb_with_spacing,
id, &hovered, &held, button_flags);
10823 if (pressed || hovered)
10826 g.NavDisableHighlight =
true;
10831 if (hovered || selected)
10858 *p_selected = !*p_selected;
10884 if (label_size.
x > 0)
10896 if (height_in_items < 0)
10897 height_in_items =
ImMin(items_count, 7);
10898 float height_in_items_f = height_in_items < items_count ? (height_in_items + 0.40f) : (height_in_items + 0.00
f);
10923 bool ImGui::ListBox(
const char*
label,
int* current_item,
const char*
const items[],
int items_count,
int height_items)
10926 return value_changed;
10929 bool ImGui::ListBox(
const char*
label,
int* current_item,
bool (*items_getter)(
void*,
int,
const char**),
void*
data,
int items_count,
int height_in_items)
10935 bool value_changed =
false;
10937 while (clipper.Step())
10938 for (
int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
10940 const bool item_selected = (i == *current_item);
10941 const char* item_text;
10942 if (!items_getter(
data, i, &item_text))
10943 item_text =
"*Unknown item*";
10949 value_changed =
true;
10956 return value_changed;
10976 float w = label_size.
x;
10989 if (shortcut_size.
x > 0.0f)
11006 *p_selected = !*p_selected;
11026 g.CurrentWindow->DC.MenuBarOffsetX +=
g.Style.DisplaySafeAreaPadding.x;
11036 if (
g.CurrentWindow ==
g.NavWindow &&
g.NavLayer == 0)
11083 nav_earliest_child = nav_earliest_child->
ParentWindow;
11092 g.NavDisableHighlight =
true;
11125 bool menuset_is_open = !(window->
Flags &
ImGuiWindowFlags_Popup) && (
g.OpenPopupStack.Size >
g.CurrentPopupStack.Size &&
g.OpenPopupStack[
g.CurrentPopupStack.Size].OpenParentId == window->
IDStack.
back());
11127 if (menuset_is_open)
11128 g.NavWindow = window;
11140 float w = label_size.
x;
11158 if (menuset_is_open)
11159 g.NavWindow = backed_nav_window;
11161 bool want_open =
false, want_close =
false;
11165 bool moving_within_opened_triangle =
false;
11166 if (
g.HoveredWindow == window &&
g.OpenPopupStack.
Size >
g.CurrentPopupStack.Size &&
g.OpenPopupStack[
g.CurrentPopupStack.Size].ParentWindow == window && !(window->
Flags &
ImGuiWindowFlags_MenuBar))
11168 if (
ImGuiWindow* next_window =
g.OpenPopupStack[
g.CurrentPopupStack.Size].Window)
11170 ImRect next_window_rect = next_window->Rect();
11171 ImVec2 ta =
g.IO.MousePos -
g.IO.MouseDelta;
11172 ImVec2 tb = (window->
Pos.
x < next_window->Pos.x) ? next_window_rect.
GetTL() : next_window_rect.
GetTR();
11174 float extra =
ImClamp(fabsf(ta.
x - tb.
x) * 0.30f, 5.0f, 30.0f);
11175 ta.
x += (window->
Pos.
x < next_window->Pos.x) ? -0.5
f : +0.5
f;
11176 tb.
y = ta.
y +
ImMax((tb.
y - extra) - ta.
y, -100.0f);
11177 tc.y = ta.
y +
ImMin((
tc.y + extra) - ta.
y, +100.0f);
11183 want_close = (menu_is_open && !hovered &&
g.HoveredWindow == window &&
g.HoveredIdPreviousFrame != 0 &&
g.HoveredIdPreviousFrame !=
id && !moving_within_opened_triangle);
11184 want_open = (!menu_is_open && hovered && !moving_within_opened_triangle) || (!menu_is_open && hovered && pressed);
11186 if (
g.NavActivateId ==
id)
11188 want_close = menu_is_open;
11189 want_open = !menu_is_open;
11200 if (menu_is_open && pressed && menuset_is_open)
11203 want_open = menu_is_open =
false;
11205 else if (pressed || (hovered && menuset_is_open && !menu_is_open))
11209 else if (
g.NavId ==
id &&
g.NavMoveRequest &&
g.NavMoveDir ==
ImGuiDir_Down)
11221 if (!menu_is_open && want_open &&
g.OpenPopupStack.Size >
g.CurrentPopupStack.Size)
11228 menu_is_open |= want_open;
11239 return menu_is_open;
11267 if (text_end > text)
11273 ImVec2 sz(
g.FontSize * 3 +
g.Style.FramePadding.y * 2,
g.FontSize * 3 +
g.Style.FramePadding.y * 2);
11277 Text(
"#%02X%02X%02X\nR: %d, G: %d, B: %d\n(%.3f, %.3f, %.3f)", cr, cg, cb, cr, cg, cb, col[0], col[1], col[2]);
11279 Text(
"#%02X%02X%02X%02X\nR:%d, G:%d, B:%d, A:%d\n(%.3f, %.3f, %.3f, %.3f)", cr, cg, cb, ca, cr, cg, cb, ca, col[0], col[1], col[2], col[3]);
11304 for (
float y = p_min.
y + grid_off.
y;
y < p_max.
y;
y += grid_step, yi++)
11309 for (
float x = p_min.
x + grid_off.
x + (yi & 1) * grid_step;
x < p_max.
x;
x += grid_step * 2.0f)
11314 int rounding_corners_flags_cell = 0;
11317 rounding_corners_flags_cell &= rounding_corners_flags;
11340 g.ColorEditOptions =
flags;
11355 if (
size.x == 0.0f)
11356 size.x = default_size;
11357 if (
size.y == 0.0f)
11358 size.y = default_size;
11360 ItemSize(bb, (
size.y >= default_size) ?
g.Style.FramePadding.y : 0.0f);
11364 bool hovered, held;
11370 ImVec4 col_without_alpha(col.
x, col.
y, col.
z, 1.0f);
11372 float rounding =
ImMin(
g.Style.FrameRounding, grid_step * 0.5f);
11374 float off = -0.75f;
11378 float mid_x = (float)(
int)((bb_inner.
Min.
x + bb_inner.
Max.
x) * 0.5
f + 0.5
f);
11386 if (col_source.
w < 1.0f)
11392 if (
g.Style.FrameBorderSize > 0.0f)
11427 if ((!allow_opt_inputs && !allow_opt_datatype) || !
BeginPopup(
"context"))
11431 if (allow_opt_inputs)
11437 if (allow_opt_datatype)
11444 if (allow_opt_inputs || allow_opt_datatype)
11467 g.ColorEditOptions = opts;
11475 if ((!allow_opt_picker && !allow_opt_alpha_bar) || !
ImGui::BeginPopup(
"context"))
11478 if (allow_opt_picker)
11482 for (
int picker_type = 0; picker_type < 2; picker_type++)
11501 if (allow_opt_alpha_bar)
11551 float f[4] = { col[0], col[1], col[2],
alpha ? col[3] : 1.0f };
11556 bool value_changed =
false;
11557 bool value_changed_as_float =
false;
11566 const char*
ids[4] = {
"##X",
"##Y",
"##Z",
"##W" };
11567 const char* fmt_table_int[3][4] =
11569 {
"%3.0f",
"%3.0f",
"%3.0f",
"%3.0f" },
11570 {
"R:%3.0f",
"G:%3.0f",
"B:%3.0f",
"A:%3.0f" },
11571 {
"H:%3.0f",
"S:%3.0f",
"V:%3.0f",
"A:%3.0f" }
11573 const char* fmt_table_float[3][4] =
11575 {
"%0.3f",
"%0.3f",
"%0.3f",
"%0.3f" },
11576 {
"R:%0.3f",
"G:%0.3f",
"B:%0.3f",
"A:%0.3f" },
11577 {
"H:%0.3f",
"S:%0.3f",
"V:%0.3f",
"A:%0.3f" }
11589 value_changed = value_changed_as_float = value_changed |
DragFloat(
ids[
n], &
f[
n], 1.0
f/255.0
f, 0.0
f, hdr ? 0.0
f : 1.0
f, fmt_table_float[fmt_idx][
n]);
11591 value_changed |=
DragInt(
ids[
n], &i[
n], 1.0
f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][
n]);
11603 ImFormatString(
buf,
IM_ARRAYSIZE(
buf),
"#%02X%02X%02X%02X",
ImClamp(i[0],0,255),
ImClamp(i[1],0,255),
ImClamp(i[2],0,255),
ImClamp(i[3],0,255));
11605 ImFormatString(
buf,
IM_ARRAYSIZE(
buf),
"#%02X%02X%02X",
ImClamp(i[0],0,255),
ImClamp(i[1],0,255),
ImClamp(i[2],0,255));
11609 value_changed =
true;
11613 i[0] = i[1] = i[2] = i[3] = 0;
11615 sscanf(
p,
"%02X%02X%02X%02X", (
unsigned int*)&i[0], (
unsigned int*)&i[1], (
unsigned int*)&i[2], (
unsigned int*)&i[3]);
11617 sscanf(
p,
"%02X%02X%02X", (
unsigned int*)&i[0], (
unsigned int*)&i[1], (
unsigned int*)&i[2]);
11630 const ImVec4 col_v4(col[0], col[1], col[2],
alpha ? col[3] : 1.0
f);
11636 g.ColorPickerRef = col_v4;
11646 picker_active_window =
g.CurrentWindow;
11647 if (
label != label_display_end)
11655 value_changed |=
ColorPicker4(
"##picker", col, picker_flags, &
g.ColorPickerRef.x);
11668 if (picker_active_window ==
NULL)
11670 if (!value_changed_as_float)
11671 for (
int n = 0;
n < 4;
n++)
11672 f[
n] = i[
n] / 255.0
f;
11693 memcpy((
float*)col, payload->Data,
sizeof(
float) * 3);
11694 value_changed =
true;
11699 value_changed =
true;
11705 if (picker_active_window &&
g.ActiveId != 0 &&
g.ActiveIdWindow == picker_active_window)
11708 return value_changed;
11713 float col4[4] = { col[0], col[1], col[2], 1.0f };
11716 col[0] = col4[0]; col[1] = col4[1]; col[2] = col4[2];
11775 float bars_width = square_sz;
11779 float bars_triangles_half_sz = (float)(
int)(bars_width * 0.20f);
11781 float backup_initial_col[4];
11784 float wheel_thickness = sv_picker_size * 0.08f;
11785 float wheel_r_outer = sv_picker_size * 0.50f;
11786 float wheel_r_inner = wheel_r_outer - wheel_thickness;
11787 ImVec2 wheel_center(picker_pos.
x + (sv_picker_size + bars_width)*0.5f, picker_pos.
y + sv_picker_size*0.5f);
11790 float triangle_r = wheel_r_inner - (int)(sv_picker_size * 0.027
f);
11792 ImVec2 triangle_pb =
ImVec2(triangle_r * -0.5
f, triangle_r * -0.866025
f);
11793 ImVec2 triangle_pc =
ImVec2(triangle_r * -0.5
f, triangle_r * +0.866025
f);
11798 bool value_changed =
false, value_changed_h =
false, value_changed_sv =
false;
11807 ImVec2 initial_off =
g.IO.MouseClickedPos[0] - wheel_center;
11808 ImVec2 current_off =
g.IO.MousePos - wheel_center;
11810 if (initial_dist2 >= (wheel_r_inner-1)*(wheel_r_inner-1) && initial_dist2 <= (wheel_r_outer+1)*(wheel_r_outer+1))
11813 H = atan2f(current_off.
y, current_off.
x) /
IM_PI*0.5f;
11816 value_changed = value_changed_h =
true;
11818 float cos_hue_angle = cosf(-H * 2.0
f *
IM_PI);
11819 float sin_hue_angle = sinf(-H * 2.0
f *
IM_PI);
11823 ImVec2 current_off_unrotated =
ImRotate(current_off, cos_hue_angle, sin_hue_angle);
11825 current_off_unrotated =
ImTriangleClosestPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated);
11830 value_changed = value_changed_sv =
true;
11844 value_changed = value_changed_sv =
true;
11855 value_changed = value_changed_h =
true;
11867 value_changed =
true;
11881 if (
label != label_display_end)
11896 if (ref_col !=
NULL)
11903 value_changed =
true;
11911 if (value_changed_h || value_changed_sv)
11912 ColorConvertHSVtoRGB(H >= 1.0
f ? H - 10 * 1e-6
f : H, S > 0.0
f ? S : 10*1e-6
f, V > 0.0
f ? V : 1e-6
f, col[0], col[1], col[2]);
11917 PushItemWidth((alpha_bar ? bar1_pos_x : bar0_pos_x) + bars_width - picker_pos.
x);
11932 float new_H, new_S, new_V;
11934 if (new_H <= 0 && H > 0)
11936 if (new_V <= 0 && V != new_V)
11938 else if (new_S <= 0)
11947 const ImU32 hue_colors[6+1] = {
IM_COL32(255,0,0,255),
IM_COL32(255,255,0,255),
IM_COL32(0,255,0,255),
IM_COL32(0,255,255,255),
IM_COL32(0,0,255,255),
IM_COL32(255,0,255,255),
IM_COL32(255,0,0,255) };
11953 const float aeps = 1.5f / wheel_r_outer;
11954 const int segment_per_arc =
ImMax(4, (
int)wheel_r_outer / 12);
11955 for (
int n = 0;
n < 6;
n++)
11957 const float a0 = (
n) /6.0
f * 2.0
f *
IM_PI - aeps;
11958 const float a1 = (
n+1.0f)/6.0
f * 2.0
f *
IM_PI + aeps;
11960 draw_list->
PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer)*0.5
f, a0, a1, segment_per_arc);
11965 ImVec2 gradient_p0(wheel_center.
x + cosf(a0) * wheel_r_inner, wheel_center.
y + sinf(a0) * wheel_r_inner);
11966 ImVec2 gradient_p1(wheel_center.
x + cosf(a1) * wheel_r_inner, wheel_center.
y + sinf(a1) * wheel_r_inner);
11971 float cos_hue_angle = cosf(H * 2.0
f *
IM_PI);
11972 float sin_hue_angle = sinf(H * 2.0
f *
IM_PI);
11973 ImVec2 hue_cursor_pos(wheel_center.
x + cos_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f, wheel_center.
y + sin_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f);
11974 float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f;
11975 int hue_cursor_segments =
ImClamp((
int)(hue_cursor_rad / 1.4
f), 9, 32);
11976 draw_list->
AddCircleFilled(hue_cursor_pos, hue_cursor_rad, hue_color32, hue_cursor_segments);
11977 draw_list->
AddCircle(hue_cursor_pos, hue_cursor_rad+1,
IM_COL32(128,128,128,255), hue_cursor_segments);
11981 ImVec2 tra = wheel_center +
ImRotate(triangle_pa, cos_hue_angle, sin_hue_angle);
11982 ImVec2 trb = wheel_center +
ImRotate(triangle_pb, cos_hue_angle, sin_hue_angle);
11983 ImVec2 trc = wheel_center +
ImRotate(triangle_pc, cos_hue_angle, sin_hue_angle);
11986 draw_list->
PrimVtx(tra, uv_white, hue_color32);
11987 draw_list->
PrimVtx(trb, uv_white, hue_color32);
12001 sv_cursor_pos.
x =
ImClamp((
float)(
int)(picker_pos.
x +
ImSaturate(S) * sv_picker_size + 0.5
f), picker_pos.
x + 2, picker_pos.
x + sv_picker_size - 2);
12002 sv_cursor_pos.
y =
ImClamp((
float)(
int)(picker_pos.
y +
ImSaturate(1 - V) * sv_picker_size + 0.5
f), picker_pos.
y + 2, picker_pos.
y + sv_picker_size - 2);
12005 for (
int i = 0; i < 6; ++i)
12006 draw_list->
AddRectFilledMultiColor(
ImVec2(bar0_pos_x, picker_pos.
y + i * (sv_picker_size / 6)),
ImVec2(bar0_pos_x + bars_width, picker_pos.
y + (i + 1) * (sv_picker_size / 6)), hue_colors[i], hue_colors[i], hue_colors[i + 1], hue_colors[i + 1]);
12007 float bar0_line_y = (float)(
int)(picker_pos.
y + H * sv_picker_size + 0.5f);
12013 float sv_cursor_rad = value_changed_sv ? 10.0f : 6.0f;
12014 draw_list->
AddCircleFilled(sv_cursor_pos, sv_cursor_rad, col32_no_alpha, 12);
12015 draw_list->
AddCircle(sv_cursor_pos, sv_cursor_rad+1,
IM_COL32(128,128,128,255), 12);
12022 ImRect bar1_bb(bar1_pos_x, picker_pos.
y, bar1_pos_x + bars_width, picker_pos.
y + sv_picker_size);
12025 float bar1_line_y = (float)(
int)(picker_pos.
y + (1.0f -
alpha) * sv_picker_size + 0.5
f);
12033 return value_changed &&
memcmp(backup_initial_col, col,
components *
sizeof(
float));
12058 float x1 = window->
Pos.
x;
12110 bool item_add =
ItemAdd(bb,
id);
12115 bool hovered, held;
12116 ImRect bb_interact = bb;
12119 if (
g.ActiveId !=
id)
12122 if (held || (
g.HoveredId ==
id &&
g.HoveredIdPreviousFrame ==
id))
12128 ImVec2 mouse_delta_2d =
g.IO.MousePos -
g.ActiveIdClickOffset - bb_interact.
Min;
12129 float mouse_delta = (axis ==
ImGuiAxis_Y) ? mouse_delta_2d.
y : mouse_delta_2d.
x;
12132 if (mouse_delta < min_size1 - *size1)
12133 mouse_delta = min_size1 - *size1;
12134 if (mouse_delta > *size2 - min_size2)
12135 mouse_delta = *size2 - min_size2;
12138 *size1 += mouse_delta;
12139 *size2 -= mouse_delta;
12217 window->
DC.
CursorPos = group_data.BackupCursorPos;
12221 window->
DC.
IndentX = group_data.BackupIndentX;
12225 if (group_data.AdvanceCursor)
12228 ItemSize(group_bb.
GetSize(), group_data.BackupCurrentLineTextBaseOffset);
12234 const bool active_id_within_group = (!group_data.BackupActiveIdIsAlive &&
g.ActiveIdIsAlive &&
g.ActiveId &&
g.ActiveIdWindow->RootWindow == window->
RootWindow);
12235 if (active_id_within_group)
12258 if (spacing_w < 0.0
f) spacing_w = 0.0f;
12264 if (spacing_w < 0.0
f) spacing_w =
g.Style.ItemSpacing.x;
12336 return offset_norm * (columns->
MaxX - columns->
MinX);
12369 if (column_index < 0)
12370 column_index = columns->
Current;
12383 const float t = columns->
Columns[column_index].OffsetNorm;
12390 if (column_index < 0)
12391 column_index = columns->
Current;
12395 offset_norm = columns->
Columns[column_index + 1].OffsetNormBeforeResize - columns->
Columns[column_index].OffsetNormBeforeResize;
12397 offset_norm = columns->
Columns[column_index + 1].OffsetNorm - columns->
Columns[column_index].OffsetNorm;
12407 if (column_index < 0)
12408 column_index = columns->
Current;
12419 if (column_index < 0)
12420 column_index = columns->
Current;
12430 if (preserve_width)
12440 if (column_index < 0)
12441 column_index = columns->
Current;
12449 if (column_index < 0)
12450 column_index = columns->
Current;
12477 PushID(0x11223347 + (str_id ? 0 : columns_count));
12478 ImGuiID id = window->
GetID(str_id ? str_id :
"columns");
12485 columns->
Count = columns_count;
12493 columns->
MaxX = content_region_width - window->
Scroll.
x;
12509 for (
int n = 0;
n < columns_count + 1;
n++)
12512 column.OffsetNorm =
n / (float)columns_count;
12517 for (
int n = 0;
n < columns_count + 1;
n++)
12521 float t =
column->OffsetNorm;
12526 if (
n == columns_count)
12558 bool is_being_resized =
false;
12563 int dragging_column = -1;
12564 for (
int n = 1;
n < columns->
Count;
n++)
12574 bool hovered =
false, held =
false;
12578 if (hovered || held)
12581 dragging_column =
n;
12586 const float xi = (float)(
int)
x;
12591 if (dragging_column != -1)
12594 for (
int n = 0;
n < columns->
Count + 1;
n++)
12595 columns->
Columns[
n].OffsetNormBeforeResize = columns->
Columns[
n].OffsetNorm;
12618 if (columns_count != 1)
12626 window->
DC.
IndentX += (indent_w != 0.0f) ? indent_w :
g.Style.IndentSpacing;
12634 window->
DC.
IndentX -= (indent_w != 0.0f) ? indent_w :
g.Style.IndentSpacing;
12643 PushID(str_id ? str_id :
"#TreePush");
12651 PushID(ptr_id ? ptr_id : (
const void*)
"#TreePush");
12682 Text(
"%s: %s", prefix, (
b ?
"true" :
"false"));
12687 Text(
"%s: %d", prefix,
v);
12692 Text(
"%s: %d", prefix,
v);
12701 Text(fmt, prefix,
v);
12705 Text(
"%s: %.3f", prefix,
v);
12717 g.DragDropPayload.Clear();
12718 g.DragDropAcceptIdCurr =
g.DragDropAcceptIdPrev = 0;
12719 g.DragDropAcceptIdCurrRectSurface =
FLT_MAX;
12720 g.DragDropAcceptFrameCount = -1;
12730 bool source_drag_active =
false;
12732 ImGuiID source_parent_id = 0;
12733 int mouse_button = 0;
12737 if (source_id != 0 &&
g.ActiveId != source_id)
12739 if (
g.IO.MouseDown[mouse_button] ==
false)
12742 if (source_id == 0)
12757 if (!is_hovered && (
g.ActiveId == 0 ||
g.ActiveIdWindow != window))
12762 if (is_hovered &&
g.IO.MouseClicked[mouse_button])
12767 if (
g.ActiveId == source_id)
12768 g.ActiveIdAllowOverlap = is_hovered;
12770 if (
g.ActiveId != source_id)
12778 source_id =
ImHash(
"#SourceExtern", 0);
12779 source_drag_active =
true;
12782 if (source_drag_active)
12784 if (!
g.DragDropActive)
12791 g.DragDropActive =
true;
12792 g.DragDropSourceFlags =
flags;
12793 g.DragDropMouseButton = mouse_button;
12827 if (
g.DragDropPayload.DataFrameCount == -1)
12849 g.DragDropPayloadBufHeap.resize(0);
12850 if (data_size >
sizeof(
g.DragDropPayloadBufLocal))
12853 g.DragDropPayloadBufHeap.resize((
int)data_size);
12854 payload.
Data =
g.DragDropPayloadBufHeap.Data;
12857 else if (data_size > 0)
12860 memset(&
g.DragDropPayloadBufLocal, 0,
sizeof(
g.DragDropPayloadBufLocal));
12861 payload.
Data =
g.DragDropPayloadBufLocal;
12868 payload.
DataSize = (int)data_size;
12872 return (
g.DragDropAcceptFrameCount ==
g.FrameCount) || (
g.DragDropAcceptFrameCount ==
g.FrameCount - 1);
12878 if (!
g.DragDropActive)
12888 g.DragDropTargetRect = bb;
12889 g.DragDropTargetId =
id;
12900 if (!
g.DragDropActive)
12913 if (
g.DragDropPayload.SourceId ==
id)
12916 g.DragDropTargetRect = display_rect;
12917 g.DragDropTargetId =
id;
12939 const bool was_accepted_previously = (
g.DragDropAcceptIdPrev ==
g.DragDropTargetId);
12941 float r_surface =
r.
GetWidth() *
r.GetHeight();
12942 if (r_surface <
g.DragDropAcceptIdCurrRectSurface)
12944 g.DragDropAcceptIdCurr =
g.DragDropTargetId;
12945 g.DragDropAcceptIdCurrRectSurface = r_surface;
12949 payload.
Preview = was_accepted_previously;
12961 g.DragDropAcceptFrameCount =
g.FrameCount;
12980 #if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)) 12981 #undef WIN32_LEAN_AND_MEAN 12982 #define WIN32_LEAN_AND_MEAN 12983 #ifndef __MINGW32__ 12984 #include <Windows.h> 12986 #include <windows.h> 12991 #if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) 12994 #pragma comment(lib, "user32") 13001 if (!OpenClipboard(
NULL))
13003 HANDLE wbuf_handle = GetClipboardData(CF_UNICODETEXT);
13004 if (wbuf_handle ==
NULL)
13012 buf_local.
resize(buf_len);
13015 GlobalUnlock(wbuf_handle);
13017 return buf_local.
Data;
13022 if (!OpenClipboard(
NULL))
13025 HGLOBAL wbuf_handle = GlobalAlloc(GMEM_MOVEABLE, (SIZE_T)wbuf_length *
sizeof(
ImWchar));
13026 if (wbuf_handle ==
NULL)
13033 GlobalUnlock(wbuf_handle);
13035 SetClipboardData(CF_UNICODETEXT, wbuf_handle);
13053 const char* text_end = text + strlen(text);
13054 g.PrivateClipboard.resize((
int)(text_end - text) + 1);
13055 memcpy(&
g.PrivateClipboard[0], text, (
size_t)(text_end - text));
13056 g.PrivateClipboard[(int)(text_end - text)] = 0;
13062 #if defined(_WIN32) && !defined(__GNUC__) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS) 13066 #pragma comment(lib, "imm32") 13073 if (HIMC himc = ImmGetContext(hwnd))
13075 COMPOSITIONFORM cf;
13076 cf.ptCurrentPos.x =
x;
13077 cf.ptCurrentPos.y =
y;
13078 cf.dwStyle = CFS_FORCE_POSITION;
13079 ImmSetCompositionWindow(himc, &cf);
13101 static bool show_clip_rects =
true;
13102 ImGui::Checkbox(
"Show clipping rectangles when hovering draw commands", &show_clip_rects);
13124 int elem_offset = 0;
13127 if (pcmd->UserCallback ==
NULL && pcmd->ElemCount == 0)
13129 if (pcmd->UserCallback)
13131 ImGui::BulletText(
"Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData);
13135 bool pcmd_node_open =
ImGui::TreeNode((
void*)(pcmd - draw_list->
CmdBuffer.
begin()),
"Draw %4d %s vtx, tex 0x%p, clip_rect (%4.0f,%4.0f)-(%4.0f,%4.0f)", pcmd->ElemCount, draw_list->
IdxBuffer.
Size > 0 ?
"indexed" :
"non-indexed", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
13138 ImRect clip_rect = pcmd->ClipRect;
13140 for (
int i = elem_offset; i < elem_offset + (int)pcmd->ElemCount; i++)
13141 vtxs_rect.
Add(draw_list->
VtxBuffer[idx_buffer ? idx_buffer[i] : i].pos);
13145 if (!pcmd_node_open)
13150 while (clipper.
Step())
13155 ImVec2 triangles_pos[3];
13156 for (
int n = 0;
n < 3;
n++, vtx_i++)
13159 triangles_pos[
n] =
v.pos;
13160 buf_p +=
ImFormatString(buf_p, (
int)(buf_end - buf_p),
"%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\n", (
n == 0) ?
"vtx" :
" ", vtx_i,
v.pos.x,
v.pos.y,
v.uv.x,
v.uv.y,
v.col);
13168 overlay_draw_list->
Flags = backup_flags;
13180 for (
int i = 0; i < windows.
Size; i++)
13181 Funcs::NodeWindow(windows[i],
"Window");
13190 NodeDrawList(window, window->
DrawList,
"DrawList");
13191 ImGui::BulletText(
"Pos: (%.1f,%.1f), Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->
Pos.
x, window->
Pos.
y, window->
Size.
x, window->
Size.
y, window->
SizeContents.
x, window->
SizeContents.
y);
13212 Funcs::NodeWindows(
g.Windows,
"Windows");
13213 if (
ImGui::TreeNode(
"DrawList",
"Active DrawLists (%d)",
g.DrawDataBuilder.Layers[0].Size))
13215 for (
int i = 0; i <
g.DrawDataBuilder.Layers[0].Size; i++)
13216 Funcs::NodeDrawList(
NULL,
g.DrawDataBuilder.Layers[0][i],
"DrawList");
13219 if (
ImGui::TreeNode(
"Popups",
"Open Popups Stack (%d)",
g.OpenPopupStack.Size))
13221 for (
int i = 0; i <
g.OpenPopupStack.Size; i++)
13231 ImGui::Text(
"HoveredWindow: '%s'",
g.HoveredWindow ?
g.HoveredWindow->Name :
"NULL");
13232 ImGui::Text(
"HoveredRootWindow: '%s'",
g.HoveredRootWindow ?
g.HoveredRootWindow->Name :
"NULL");
13233 ImGui::Text(
"HoveredId: 0x%08X/0x%08X (%.2f sec)",
g.HoveredId,
g.HoveredIdPreviousFrame,
g.HoveredIdTimer);
13234 ImGui::Text(
"ActiveId: 0x%08X/0x%08X (%.2f sec), ActiveIdSource: %s",
g.ActiveId,
g.ActiveIdPreviousFrame,
g.ActiveIdTimer, input_source_names[
g.ActiveIdSource]);
13235 ImGui::Text(
"ActiveIdWindow: '%s'",
g.ActiveIdWindow ?
g.ActiveIdWindow->Name :
"NULL");
13236 ImGui::Text(
"NavWindow: '%s'",
g.NavWindow ?
g.NavWindow->Name :
"NULL");
13237 ImGui::Text(
"NavId: 0x%08X, NavLayer: %d",
g.NavId,
g.NavLayer);
13238 ImGui::Text(
"NavActive: %d, NavVisible: %d",
g.IO.NavActive,
g.IO.NavVisible);
13239 ImGui::Text(
"NavActivateId: 0x%08X, NavInputId: 0x%08X",
g.NavActivateId,
g.NavInputId);
13240 ImGui::Text(
"NavDisableHighlight: %d, NavDisableMouseHover: %d",
g.NavDisableHighlight,
g.NavDisableMouseHover);
13241 ImGui::Text(
"DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)",
g.DragDropActive,
g.DragDropPayload.SourceId,
g.DragDropPayload.DataType,
g.DragDropPayload.DataSize);
13252 #ifdef IMGUI_INCLUDE_IMGUI_USER_INL 13253 #include "imgui_user.inl"
void * memmove(void *dst, const void *src, size_t n)
float NavInputs[ImGuiNavInput_COUNT]
IMGUI_API void TreePush(const char *str_id)
const char * ImStristr(const char *haystack, const char *haystack_end, const char *needle, const char *needle_end)
IMGUI_API bool BeginPopupContextItem(const char *str_id=NULL, int mouse_button=1)
void * ImFileLoadToMemory(const char *filename, const char *file_open_mode, int *out_file_size, int padding_bytes)
static ImVector< ImGuiStorage::Pair >::iterator LowerBound(ImVector< ImGuiStorage::Pair > &data, ImGuiID key)
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val)
static void UpdateManualResize(ImGuiWindow *window, const ImVec2 &size_auto_fit, int *border_held, int resize_grip_count, ImU32 resize_grip_col[4])
IMGUI_API void SetNextWindowSize(const ImVec2 &size, ImGuiCond cond=0)
ImRect MenuBarRect() const
const ImWchar * ImStrbolW(const ImWchar *buf_mid_line, const ImWchar *buf_begin)
IMGUI_API bool ColorPicker3(const char *label, float col[3], ImGuiColorEditFlags flags=0)
#define IMGUI_PAYLOAD_TYPE_COLOR_4F
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
IMGUI_API bool SliderBehavior(const ImRect &frame_bb, ImGuiID id, float *v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags=0)
IMGUI_API void TextColoredV(const ImVec4 &col, const char *fmt, va_list args) IM_FMTLIST(2)
const char *(* GetClipboardTextFn)(void *user_data)
int FocusIdxTabRequestNext
static ImGuiWindow * NavRestoreLastChildNavWindow(ImGuiWindow *window)
IMGUI_API bool IsWindowHovered(ImGuiHoveredFlags flags=0)
IMGUI_API float GetCursorPosX()
void PathStroke(ImU32 col, bool closed, float thickness=1.0f)
void(* WriteAllFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *out_buf)
IMGUI_API float * GetFloatRef(ImGuiID key, float default_val=0.0f)
ImGuiWindow * RootWindowForTitleBarHighlight
IMGUI_API ImVec2 GetCursorStartPos()
static bool Items_ArrayGetter(void *data, int idx, const char **out_text)
static int InputTextCalcTextLenAndLineCount(const char *text_begin, const char **out_text_end)
IMGUI_API void SetTooltip(const char *fmt,...) IM_FMTARGS(1)
#define va_copy(dest, src)
int ImFormatStringV(char *buf, size_t buf_size, const char *fmt, va_list args)
IMGUI_API bool ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFlags flags=0)
IMGUI_API void RenderText(ImVec2 pos, const char *text, const char *text_end=NULL, bool hide_text_after_hash=true)
IMGUI_API bool IsMouseReleased(int button)
IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiCond cond=0)
#define STB_TEXTEDIT_K_BACKSPACE
#define STB_TEXTEDIT_GETWIDTH_NEWLINE
ImVec2 ImLineClosestPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &p)
IMGUI_API bool RadioButton(const char *label, bool active)
void * GetVarPtr(ImGuiStyle *style) const
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond=0)
IMGUI_API ImVec2 GetCursorPos()
static float CalcMaxPopupHeightFromItemCount(int items_count)
static float GetColumnWidthEx(ImGuiColumnsSet *columns, int column_index, bool before_resize=false)
static void SetNavIDAndMoveMouse(ImGuiID id, int nav_layer, const ImRect &rect_rel)
ImGuiCond SetWindowPosAllowFlags
IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio=0.5f)
void ImTriangleBarycentricCoords(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p, float &out_u, float &out_v, float &out_w)
static bool IsKeyPressedMap(ImGuiKey key, bool repeat=true)
static ImWchar STB_TEXTEDIT_NEWLINE
bool ActiveIdIsJustActivated
#define STB_TEXTEDIT_K_WORDLEFT
IMGUI_API float GetFontSize()
IMGUI_API void AddCircle(const ImVec2 ¢re, float radius, ImU32 col, int num_segments=12, float thickness=1.0f)
IMGUI_API void AddRectFilledMultiColor(const ImVec2 &a, const ImVec2 &b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)
IMGUI_API void MarkIniSettingsDirty()
IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col, float sz)
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), int frame_padding=-1, const ImVec4 &bg_col=ImVec4(0, 0, 0, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1))
IMGUI_API void SetVoidPtr(ImGuiID key, void *val)
ImGuiWindow * ParentWindow
IMGUI_API void PushColumnClipRect(int column_index=-1)
static int ImTextCharToUtf8(char *buf, int buf_size, unsigned int c)
IMGUI_API void PopTextureID()
IMGUI_API void ColorEditOptionsPopup(const float *col, ImGuiColorEditFlags flags)
IMGUI_API void ProgressBar(float fraction, const ImVec2 &size_arg=ImVec2(-1, 0), const char *overlay=NULL)
IMGUI_API float RoundScalar(float value, int decimal_precision)
static ImRect GetBorderRect(ImGuiWindow *window, int border_n, float perp_padding, float thickness)
IMGUI_API bool IsPopupOpen(ImGuiID id)
IMGUI_API void AddInputCharacter(ImWchar c)
IMGUI_API void SetColumnWidth(int column_index, float width)
IMGUI_API void AlignTextToFramePadding()
static void SetWindowScrollX(ImGuiWindow *window, float new_scroll_x)
static ImFont * GetDefaultFont()
IMGUI_API ImGuiStorage * GetStateStorage()
IMGUI_API void PopClipRect()
int ImStrnicmp(const char *str1, const char *str2, size_t count)
void OnKeyPressed(int key)
void(* SetClipboardTextFn)(void *user_data, const char *text)
IMGUI_API void DeleteChars(int pos, int bytes_count)
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow *ref_window)
IMGUI_API bool InputTextMultiline(const char *label, char *buf, size_t buf_size, const ImVec2 &size=ImVec2(0, 0), ImGuiInputTextFlags flags=0, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
static void FocusFrontMostActiveWindow(ImGuiWindow *ignore_window)
IMGUI_API const char * FindRenderedTextEnd(const char *text, const char *text_end=NULL)
static void LogRenderedText(const ImVec2 *ref_pos, const char *text, const char *text_end=NULL)
int WantCaptureMouseNextFrame
IMGUI_API ImGuiWindowSettings * FindWindowSettings(ImGuiID id)
static float Plot_ArrayGetter(void *data, int idx)
IMGUI_API bool IsWindowChildOf(ImGuiWindow *window, ImGuiWindow *potential_parent)
IMGUI_API void ChannelsSetCurrent(int channel_index)
#define IMGUI_PAYLOAD_TYPE_COLOR_3F
IMGUI_API void PopItemFlag()
void PathFillConvex(ImU32 col)
IMGUI_API void appendf(const char *fmt,...) IM_FMTARGS(2)
IMGUI_API bool OpenPopupOnItemClick(const char *str_id=NULL, int mouse_button=1)
IMGUI_API bool InputInt3(const char *label, int v[3], ImGuiInputTextFlags extra_flags=0)
IMGUI_API void SetCursorPos(const ImVec2 &local_pos)
IMGUI_API bool BeginCombo(const char *label, const char *preview_value, ImGuiComboFlags flags=0)
static float ImSaturate(float f)
ImGuiLayoutType LayoutType
IMGUI_API bool BeginPopupModal(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
static bool is_separator(unsigned int c)
#define STB_TEXTEDIT_K_DELETE
void resize(int new_size)
static float GetDraggedColumnOffset(ImGuiColumnsSet *columns, int column_index)
IMGUI_API const ImGuiPayload * AcceptDragDropPayload(const char *type, ImGuiDragDropFlags flags=0)
IMGUI_API bool IsMouseClicked(int button, bool repeat=false)
static int ImTextCountUtf8BytesFromChar(unsigned int c)
IMGUI_API bool IsItemClicked(int mouse_button=0)
GLdouble GLdouble GLint stride
IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat=true)
#define IM_ARRAYSIZE(_ARR)
#define STB_TEXTEDIT_K_RIGHT
float CurveTessellationTol
IMGUI_API void * GetVoidPtr(ImGuiID key) const
IMGUI_API void PushMultiItemsWidths(int components, float width_full=0.0f)
IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding=0.0f)
IMGUI_API void PopTextWrapPos()
ImGuiInputTextFlags Flags
static void SettingsHandlerWindow_WriteAll(ImGuiContext *imgui_ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *buf)
static bool IsWindowContentHoverable(ImGuiWindow *window, ImGuiHoveredFlags flags)
IMGUI_API void CalcListClipping(int items_count, float items_height, int *out_items_display_start, int *out_items_display_end)
IMGUI_API bool IsMouseDown(int button)
ImVector< ImFontGlyph > Glyphs
static float ImFloor(float f)
IMGUI_API void AddInputCharactersUTF8(const char *utf8_chars)
bool NavHideHighlightOneFrame
IMGUI_API ImVec2 GetItemRectMin()
static void SetCurrentWindow(ImGuiWindow *window)
IMGUI_API bool IsItemActive()
IMGUI_API bool ColorPicker4(const char *label, float col[4], ImGuiColorEditFlags flags=0, const float *ref_col=NULL)
IMGUI_API void SetHoveredID(ImGuiID id)
static ImVec2 NavCalcPreferredMousePos()
static const ImGuiStyleVarInfo GStyleVarInfo[]
ImDrawList OverlayDrawList
int FocusIdxAllRequestCurrent
IMGUI_API void SetNextWindowFocus()
IMGUI_API ImVec2 GetMouseDragDelta(int button=0, float lock_threshold=-1.0f)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
IMGUI_API void NewFrame()
IMGUI_API void AddPolyline(const ImVec2 *points, const int num_points, ImU32 col, bool closed, float thickness)
bool BackupActiveIdIsAlive
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
IMGUI_API void SetItemDefaultFocus()
static bool IsNavInputDown(ImGuiNavInput n)
IMGUI_API void EndTooltip()
IMGUI_API bool FocusableItemRegister(ImGuiWindow *window, ImGuiID id, bool tab_stop=true)
IMGUI_API bool InputInt4(const char *label, int v[4], ImGuiInputTextFlags extra_flags=0)
static ImGuiWindow * FindWindowNavigable(int i_start, int i_stop, int dir)
IMGUI_API void LogButtons()
ImGuiWindow * RootWindowForNav
IMGUI_API void CaptureMouseFromApp(bool capture=true)
static void UpdateMovingWindow()
static void * GImAllocatorUserData
IMGUI_API void SetScrollHere(float center_y_ratio=0.5f)
IMGUI_API void SetAllocatorFunctions(void *(*alloc_func)(size_t sz, void *user_data), void(*free_func)(void *ptr, void *user_data), void *user_data=NULL)
IMGUI_API void PopAllowKeyboardFocus()
IMGUI_API bool SmallButton(const char *label)
ImVector< ImGuiItemFlags > ItemFlagsStack
static ImWchar STB_TEXTEDIT_GETCHAR(const STB_TEXTEDIT_STRING *obj, int idx)
IMGUI_API bool IsMouseHoveringRect(const ImVec2 &r_min, const ImVec2 &r_max, bool clip=true)
ImGuiColumnsSet * ColumnsSet
IMGUI_API void SetFocusID(ImGuiID id, ImGuiWindow *window)
IMGUI_API void PushClipRect(const ImVec2 &clip_rect_min, const ImVec2 &clip_rect_max, bool intersect_with_current_clip_rect)
IMGUI_API void BuildSortByKey()
IMGUI_API bool BeginPopup(const char *str_id, ImGuiWindowFlags flags=0)
IMGUI_API void PathArcToFast(const ImVec2 ¢re, float radius, int a_min_of_12, int a_max_of_12)
GLenum GLint GLint * precision
IMGUI_API void ShowMetricsWindow(bool *p_open=NULL)
IMGUI_API bool Draw(const char *label="Filter (inc,-exc)", float width=0.0f)
IMGUI_API bool IsDragDropPayloadBeingAccepted()
static void NavSaveLastChildNavWindow(ImGuiWindow *child_window)
IMGUI_API void BeginTooltip()
IMGUI_API bool TreeNodeEx(const char *label, ImGuiTreeNodeFlags flags=0)
static int STB_TEXTEDIT_STRINGLEN(const STB_TEXTEDIT_STRING *obj)
int(* ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data)
IMGUI_API bool IsWindowAppearing()
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char *text_begin, const char *text_end=NULL, const char **remaining=NULL) const
const ImGuiResizeGripDef resize_grip_def[4]
IMGUI_API bool ListBox(const char *label, int *current_item, const char *const items[], int items_count, int height_in_items=-1)
float KeysDownDuration[512]
IMGUI_API void PushTextureID(ImTextureID texture_id)
IMGUI_API void SetNextWindowSizeConstraints(const ImVec2 &size_min, const ImVec2 &size_max, ImGuiSizeCallback custom_callback=NULL, void *custom_callback_data=NULL)
IMGUI_API void * MemAlloc(size_t size)
void swap(ImVector< T > &rhs)
int BeginOrderWithinContext
static bool NavMoveRequestButNoResultYet()
IMGUI_API bool * GetBoolRef(ImGuiID key, bool default_val=false)
IMGUI_API void Indent(float indent_w=0.0f)
const ImFontGlyph * FallbackGlyph
float GetCharAdvance(ImWchar c) const
IMGUI_API bool IsWindowFocused(ImGuiFocusedFlags flags=0)
IMGUI_API void AddTriangleFilled(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, ImU32 col)
float BackupCurrentLineTextBaseOffset
IMGUI_API void PushTextWrapPos(float wrap_pos_x=0.0f)
IMGUI_API void PushButtonRepeat(bool repeat)
ImRect TitleBarRect() const
ImGuiStorage StateStorage
bool IsDataType(const char *type) const
IMGUI_API void ResetMouseDragDelta(int button=0)
#define STB_TEXTEDIT_K_WORDRIGHT
IMGUI_API float GetFloat(ImGuiID key, float default_val=0.0f) const
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor=0.0f, float fast_factor=0.0f)
IMGUI_API void AddRect(const ImVec2 &a, const ImVec2 &b, ImU32 col, float rounding=0.0f, int rounding_corners_flags=ImDrawCornerFlags_All, float thickness=1.0f)
IMGUI_API void SetCurrentFont(ImFont *font)
bool MouseDoubleClicked[5]
IMGUI_API void BulletTextV(const char *fmt, va_list args) IM_FMTLIST(1)
IMGUI_API ImGuiMouseCursor GetMouseCursor()
static ImRect GetViewportRect()
IMGUI_API float GetColumnOffset(int column_index=-1)
static void SetWindowConditionAllowFlags(ImGuiWindow *window, ImGuiCond flags, bool enabled)
float CalcFontSize() const
GLdouble GLdouble GLint GLint GLdouble v1
ImGuiMenuColumns MenuColumns
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char *label, const char *label_end=NULL)
IMGUI_API void SetStateStorage(ImGuiStorage *tree)
IMGUI_API void AddLine(const ImVec2 &a, const ImVec2 &b, ImU32 col, float thickness=1.0f)
IMGUI_API bool PassFilter(const char *text, const char *text_end=NULL) const
static void AddDrawListToDrawData(ImVector< ImDrawList *> *out_list, ImDrawList *draw_list)
#define IM_COL32_BLACK_TRANS
IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect=false)
GLdouble GLdouble GLdouble w
float NavInputsDownDuration[ImGuiNavInput_COUNT]
IMGUI_API bool InputText(const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
IMGUI_API void DestroyContext(ImGuiContext *ctx=NULL)
IMGUI_API bool TreeNodeV(const char *str_id, const char *fmt, va_list args) IM_FMTLIST(2)
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags=0)
IMGUI_API ImVec2 GetItemRectSize()
static bool NavScoreItem(ImGuiNavMoveResult *result, ImRect cand)
IMGUI_API float GetWindowWidth()
IMGUI_API void RenderTriangle(ImVec2 pos, ImGuiDir dir, float scale=1.0f)
IMGUI_API void ** GetVoidPtrRef(ImGuiID key, void *default_val=NULL)
IMGUI_API bool IsAnyItemFocused()
ImGuiColorEditFlags ColorEditOptions
GLenum GLenum GLsizei void GLsizei void * column
IMGUI_API void ClosePopup(ImGuiID id)
IMGUI_API bool TreeNode(const char *label)
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode)
IMGUI_API ImVec2 GetContentRegionMax()
static void * SettingsHandlerWindow_ReadOpen(ImGuiContext *, ImGuiSettingsHandler *, const char *name)
static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y)
static void AddWindowToDrawData(ImVector< ImDrawList *> *out_list, ImGuiWindow *window)
int KeyMap[ImGuiKey_COUNT]
IMGUI_API bool CheckboxFlags(const char *label, unsigned int *flags, unsigned int flags_value)
IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2 &size, ImGuiWindowFlags flags=0)
void(* ImeSetInputScreenPosFn)(int x, int y)
IMGUI_API bool ColorEdit4(const char *label, float col[4], ImGuiColorEditFlags flags=0)
IMGUI_API void ActivateItem(ImGuiID id)
IMGUI_API void SetWindowPos(const ImVec2 &pos, ImGuiCond cond=0)
static ImGuiWindow * GetFrontMostModalRootWindow()
IMGUI_API bool DragBehavior(const ImRect &frame_bb, ImGuiID id, float *v, float v_speed, float v_min, float v_max, int decimal_precision, float power)
IMGUI_API bool BeginMenuBar()
IMGUI_API ImGuiTextFilter(const char *default_filter="")
GLfloat GLfloat GLfloat alpha
GLdouble GLdouble GLdouble q
IMGUI_API void PlotHistogram(const char *label, const float *values, int values_count, int values_offset=0, const char *overlay_text=NULL, float scale_min=FLT_MAX, float scale_max=FLT_MAX, ImVec2 graph_size=ImVec2(0, 0), int stride=sizeof(float))
IMGUI_API void MemFree(void *ptr)
ImGuiWindow * RootWindowForTabbing
IMGUI_API void TextWrappedV(const char *fmt, va_list args) IM_FMTLIST(1)
IMGUI_API bool IsMousePosValid(const ImVec2 *mouse_pos=NULL)
IMGUI_API void FlattenIntoSingleLayer()
IMGUI_API bool SplitterBehavior(ImGuiID id, const ImRect &bb, ImGuiAxis axis, float *size1, float *size2, float min_size1, float min_size2, float hover_extend=0.0f)
#define STB_TEXTEDIT_K_UP
IMGUI_API ImVec2 GetMousePos()
IMGUI_API bool BeginDragDropTargetCustom(const ImRect &bb, ImGuiID id)
static void DataTypeApplyOp(ImGuiDataType data_type, int op, void *value1, const void *value2)
static void RenderArrow(ImDrawList *draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col)
int ImGuiNavHighlightFlags
IMGUI_API ImGuiID GetHoveredID()
IMGUI_API bool InputFloat3(const char *label, float v[3], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
ImGuiWindow(ImGuiContext *context, const char *name)
void * memcpy(void *dst, const void *src, size_t n)
static int ImLerp(int a, int b, float t)
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble GLdouble w2
static float GetScrollMaxX(ImGuiWindow *window)
IMGUI_API void EndDragDropSource()
ImGuiID GetIDNoKeepAlive(const char *str, const char *str_end=NULL)
IMGUI_API void SameLine(float pos_x=0.0f, float spacing_w=-1.0f)
static void ImSwap(int &a, int &b)
IMGUI_API void EndDragDropTarget()
IMGUI_API void SetMouseCursor(ImGuiMouseCursor type)
IMGUI_API bool SliderFloat2(const char *label, float v[2], float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API ImVec2 GetContentRegionAvail()
ImGuiID GetIDFromRectangle(const ImRect &r_abs)
#define STB_TEXTEDIT_K_TEXTSTART
IMGUI_API void CaptureKeyboardFromApp(bool capture=true)
IMGUI_API void RenderRectFilledRangeH(ImDrawList *draw_list, const ImRect &rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding)
static void NavProcessItem(ImGuiWindow *window, const ImRect &nav_bb, const ImGuiID id)
float CurrentLineTextBaseOffset
IMGUI_API void SetFloat(ImGuiID key, float val)
ImGuiInputTextFlags EventFlag
static float PixelsToOffsetNorm(const ImGuiColumnsSet *columns, float offset)
IMGUI_API float GetScrollMaxY()
IMGUI_API void SetCurrentContext(ImGuiContext *ctx)
#define STB_TEXTEDIT_K_LEFT
static float ImLengthSqr(const ImVec2 &lhs)
ImFontAtlas * ContainerAtlas
IMGUI_API ImDrawList * GetWindowDrawList()
ImGuiWindow * NavLastChildNavWindow
ImVector< ImGuiWindow * > Windows
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
IMGUI_API bool InputInt2(const char *label, int v[2], ImGuiInputTextFlags extra_flags=0)
IMGUI_API bool IsKeyDown(int user_key_index)
IMGUI_API void PopStyleVar(int count=1)
IMGUI_API void SetScrollY(float scroll_y)
ImVec2 SizeContentsExplicit
ImGuiNavForward NavMoveRequestForward
IMGUI_API void SetTooltipV(const char *fmt, va_list args) IM_FMTLIST(1)
ImGuiID GetID(const char *str, const char *str_end=NULL)
IMGUI_API ImVec2 CalcTextSize(const char *text, const char *text_end=NULL, bool hide_text_after_double_hash=false, float wrap_width=-1.0f)
IMGUI_API bool CollapsingHeader(const char *label, ImGuiTreeNodeFlags flags=0)
ImGuiStb::STB_TexteditState StbState
IMGUI_API ImVec2 GetWindowContentRegionMin()
IMGUI_API void AddTriangle(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, ImU32 col, float thickness=1.0f)
IMGUI_API bool BeginPopupContextWindow(const char *str_id=NULL, int mouse_button=1, bool also_over_items=true)
static int ImClamp(int v, int mn, int mx)
IMGUI_API bool ListBoxHeader(const char *label, const ImVec2 &size=ImVec2(0, 0))
IMGUI_API void Dummy(const ImVec2 &size)
static ImVec2 CalcSizeAfterConstraint(ImGuiWindow *window, ImVec2 new_size)
IMGUI_API void KeepAliveID(ImGuiID id)
void Expand(const float amount)
IMGUI_API void BulletText(const char *fmt,...) IM_FMTARGS(1)
static void NavUpdateAnyRequestFlag()
static int ImMax(int lhs, int rhs)
static void MarkIniSettingsDirty(ImGuiWindow *window)
IMGUI_API bool IsAnyItemHovered()
static bool STB_TEXTEDIT_INSERTCHARS(STB_TEXTEDIT_STRING *obj, int pos, const ImWchar *new_text, int new_text_len)
ImVector< char > TempTextBuffer
#define IM_OFFSETOF(_TYPE, _MEMBER)
GLenum GLuint GLenum GLsizei const GLchar * buf
static void *(* GImAllocatorAllocFunc)(size_t size, void *user_data)
IMGUI_API const char * GetStyleColorName(ImGuiCol idx)
IMGUI_API bool IsMouseDragging(int button=0, float lock_threshold=-1.0f)
int ImFormatString(char *buf, size_t buf_size, const char *fmt,...)
#define IMGUI_DEBUG_NAV_SCORING
static const ImGuiStyleVarInfo * GetStyleVarInfo(ImGuiStyleVar idx)
IMGUI_API bool BeginChild(const char *str_id, const ImVec2 &size=ImVec2(0, 0), bool border=false, ImGuiWindowFlags flags=0)
GLenum GLenum GLsizei const GLuint GLboolean enabled
IMGUI_API ImVec2 GetWindowContentRegionMax()
IMGUI_API int GetInt(ImGuiID key, int default_val=0) const
IMGUI_API bool IsRectVisible(const ImVec2 &size)
IMGUI_API bool SliderIntN(const char *label, int *v, int components, int v_min, int v_max, const char *display_format)
void ClipWith(const ImRect &r)
static float STB_TEXTEDIT_GETWIDTH(STB_TEXTEDIT_STRING *obj, int line_start_idx, int char_idx)
ImVec2 SizeFullAtLastBegin
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble w1
ImGuiTextEditState InputTextState
IMGUI_API void ColorTooltip(const char *text, const float *col, ImGuiColorEditFlags flags)
IMGUI_API void TextUnformatted(const char *text, const char *text_end=NULL)
bool CollapseToggleWanted
IMGUI_API void TreePushRawID(ImGuiID id)
IMGUI_API bool DragFloat4(const char *label, float v[4], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", float power=1.0f)
static int FindWindowIndex(ImGuiWindow *window)
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled)
static void NavScrollToBringItemIntoView(ImGuiWindow *window, ImRect &item_rect_rel)
FILE * ImFileOpen(const char *filename, const char *mode)
float MouseDownDuration[5]
static const char * GetClipboardTextFn_DefaultImpl(void *user_data)
IMGUI_API void Scrollbar(ImGuiLayoutType direction)
IMGUI_API void SetColumnOffset(int column_index, float offset_x)
IMGUI_API void Unindent(float indent_w=0.0f)
static void FreeWrapper(void *ptr, void *user_data)
IMGUI_API int GetColumnsCount()
IMGUI_API bool InputIntN(const char *label, int *v, int components, ImGuiInputTextFlags extra_flags)
IMGUI_API bool SliderAngle(const char *label, float *v_rad, float v_degrees_min=-360.0f, float v_degrees_max=+360.0f)
IMGUI_API void FocusWindow(ImGuiWindow *window)
ImVector< ImDrawCmd > CmdBuffer
IMGUI_API bool ColorEdit3(const char *label, float col[3], ImGuiColorEditFlags flags=0)
IMGUI_API void RenderNavHighlight(const ImRect &bb, ImGuiID id, ImGuiNavHighlightFlags flags=ImGuiNavHighlightFlags_TypeDefault)
IMGUI_API void AddText(const ImVec2 &pos, ImU32 col, const char *text_begin, const char *text_end=NULL)
ImGuiDir AutoPosLastDirection
ImRect ContentsRegionRect
ImDrawListSharedData DrawListSharedData
IMGUI_API bool SliderFloat3(const char *label, float v[3], float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup()
IMGUI_API bool ItemAdd(const ImRect &bb, ImGuiID id, const ImRect *nav_bb=NULL)
float MouseDoubleClickTime
static float NavScoreItemDistInterval(float a0, float a1, float b0, float b1)
float KeysDownDurationPrev[512]
IMGUI_API ImGuiIO & GetIO()
void Translate(const ImVec2 &v)
ImVector< ImGuiColumnData > Columns
IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect &aabb, const char *label, ImGuiDataType data_type, void *data_ptr, ImGuiID id, int decimal_precision)
int ImTextCharFromUtf8(unsigned int *out_char, const char *in_text, const char *in_text_end)
IMGUI_API bool DragInt4(const char *label, int v[4], float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API bool InputFloat2(const char *label, float v[2], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
GLint GLint GLsizei GLint border
IMGUI_API void LabelTextV(const char *label, const char *fmt, va_list args) IM_FMTLIST(2)
static float GetColumnsRectHalfWidth()
static ImGuiColumnsSet * FindOrAddColumnsSet(ImGuiWindow *window, ImGuiID id)
IMGUI_API void Shutdown(ImGuiContext *context)
IMGUI_API bool InputFloat4(const char *label, float v[4], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
GLdouble GLdouble GLdouble y2
static void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING *obj, int pos, int n)
IMGUI_API ImFont * GetFont()
IMGUI_API void EndGroup()
IMGUI_API float GetTime()
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow *window)
IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawVert *vert_start, ImDrawVert *vert_end, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1)
IMGUI_API int GetColumnIndex()
IMGUI_API void ChannelsMerge()
IMGUI_API bool IsKeyReleased(int user_key_index)
static int ImMin(int lhs, int rhs)
IMGUI_API void LogToFile(int max_depth=-1, const char *filename=NULL)
GLboolean GLboolean GLboolean GLboolean a
IMGUI_API void VerticalSeparator()
IMGUI_API bool InputFloat(const char *label, float *v, float step=0.0f, float step_fast=0.0f, int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
IMGUI_API ImGuiContext * GetCurrentContext()
static void SetWindowScrollY(ImGuiWindow *window, float new_scroll_y)
static void SetCursorPosYAndSetupDummyPrevLine(float pos_y, float line_height)
static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING *obj, int idx)
void reserve(int new_capacity)
IMGUI_API void SetWindowFocus()
IMGUI_API void EndCombo()
int NavLayerActiveMaskNext
IMGUI_API bool IsWindowCollapsed()
IMGUI_API void SetCursorPosX(float x)
static void LoadIniSettingsFromMemory(const char *buf)
IMGUI_API void Initialize(ImGuiContext *context)
static void SetWindowPos(ImGuiWindow *window, const ImVec2 &pos, ImGuiCond cond)
IMGUI_API float GetContentRegionAvailWidth()
static int STB_TEXTEDIT_KEYTOTEXT(int key)
ImVector< ImGuiWindowSettings > SettingsWindows
IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2 &a, const ImVec2 &b, const ImVec2 &uv_a=ImVec2(0, 0), const ImVec2 &uv_b=ImVec2(1, 1), ImU32 col=0xFFFFFFFF)
IMGUI_API void PushItemWidth(float item_width)
bool ImTriangleContainsPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p)
IMGUI_API ImGuiContext * CreateContext(ImFontAtlas *shared_font_atlas=NULL)
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0))
ImVec2 ScrollTargetCenterRatio
IMGUI_API void Value(const char *prefix, bool b)
IMGUI_API bool IsItemFocused()
static void SettingsHandlerWindow_ReadLine(ImGuiContext *, ImGuiSettingsHandler *, void *entry, const char *line)
int FocusIdxTabRequestCurrent
IMGUI_API void Separator()
int ImStrlenW(const ImWchar *str)
IMGUI_API void FocusableItemUnregister(ImGuiWindow *window)
static ImGuiWindowSettings * AddWindowSettings(const char *name)
static bool InputTextFilterCharacter(unsigned int *p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void *user_data)
IMGUI_API void ItemSize(const ImVec2 &size, float text_offset_y=0.0f)
IMGUI_API void BeginGroup()
bool FontAllowUserScaling
GLboolean GLboolean GLboolean b
IMGUI_API bool DragFloatRange2(const char *label, float *v_current_min, float *v_current_max, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", const char *display_format_max=NULL, float power=1.0f)
IMGUI_API bool SliderFloat4(const char *label, float v[4], float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API void AddCircleFilled(const ImVec2 ¢re, float radius, ImU32 col, int num_segments=12)
void * memset(void *s, const int c, size_t n)
#define STB_TEXTEDIT_STRING
IMGUI_API float GetScrollX()
IMGUI_API void Begin(int items_count, float items_height=-1.0f)
#define NAV_MAP_KEY(_KEY, _NAV_INPUT)
IMGUI_API bool SliderInt4(const char *label, int v[4], int v_min, int v_max, const char *display_format="%.0f")
bool HasSelection() const
IMGUI_API bool Combo(const char *label, int *current_item, const char *const items[], int items_count, int popup_max_height_in_items=-1)
IMGUI_API bool DragFloat(const char *label, float *v, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", float power=1.0f)
IMGUI_API bool BeginPopupContextVoid(const char *str_id=NULL, int mouse_button=1)
GLuint const GLchar * name
static int is_word_boundary_from_right(STB_TEXTEDIT_STRING *obj, int idx)
unsigned int _VtxCurrentIdx
IMGUI_API float GetColumnWidth(int column_index=-1)
IMGUI_API ImVec2 GetWindowSize()
IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding=0.0f, int rounding_corners_flags=~0)
char * ImStrchrRange(const char *str, const char *str_end, char c)
float PrevLineTextBaseOffset
IMGUI_API void EndPopup()
IMGUI_API float GetTreeNodeToLabelSpacing()
IMGUI_API ImVec2 GetFontTexUvWhitePixel()
static float OffsetNormToPixels(const ImGuiColumnsSet *columns, float offset_norm)
IMGUI_API void RenderTextWrapped(ImVec2 pos, const char *text, const char *text_end, float wrap_width)
#define STB_TEXTEDIT_K_LINESTART
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow *window)
IMGUI_API void ClearDragDrop()
IMGUI_API void TextV(const char *fmt, va_list args) IM_FMTLIST(1)
IMGUI_API void RenderBullet(ImVec2 pos)
IMGUI_API void NextColumn()
IMGUI_API bool ColorButton(const char *desc_id, const ImVec4 &col, ImGuiColorEditFlags flags=0, ImVec2 size=ImVec2(0, 0))
ImVector< ImGuiPopupRef > OpenPopupStack
ImGuiItemStatusFlags LastItemStatusFlags
IMGUI_API float GetWindowHeight()
IMGUI_API bool ButtonEx(const char *label, const ImVec2 &size_arg=ImVec2(0, 0), ImGuiButtonFlags flags=0)
ImVector< char > PrivateClipboard
IMGUI_API bool DragFloat2(const char *label, float v[2], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", float power=1.0f)
ImGuiPlotArrayGetterData(const float *values, int stride)
IMGUI_API bool BeginMainMenuBar()
IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4 &in)
ImVec2 DisplaySafeAreaPadding
ImGuiCond SetWindowCollapsedAllowFlags
IMGUI_API bool SliderFloatN(const char *label, float *v, int components, float v_min, float v_max, const char *display_format, float power)
static void(* GImAllocatorFreeFunc)(void *ptr, void *user_data)
IMGUI_API void BeginColumns(const char *str_id, int count, ImGuiColumnsFlags flags=0)
IMGUI_API void AddRectFilled(const ImVec2 &a, const ImVec2 &b, ImU32 col, float rounding=0.0f, int rounding_corners_flags=ImDrawCornerFlags_All)
IMGUI_API void PushFont(ImFont *font)
ImGuiWindow * CurrentWindow
IMGUI_API void SetNextWindowPos(const ImVec2 &pos, ImGuiCond cond=0, const ImVec2 &pivot=ImVec2(0, 0))
ImVec2 DisplayWindowPadding
IMGUI_API void SetClipboardText(const char *text)
IMGUI_API bool InvisibleButton(const char *str_id, const ImVec2 &size)
IMGUI_API void SetBool(ImGuiID key, bool val)
static void AddWindowToDrawDataSelectLayer(ImGuiWindow *window)
IMGUI_API void appendfv(const char *fmt, va_list args) IM_FMTLIST(2)
#define IM_F32_TO_INT8_SAT(_VAL)
IMGUI_API void EndChild()
void Update(int count, float spacing, bool clear)
IMGUI_API float GetWindowContentRegionWidth()
IMGUI_API float GetScrollMaxX()
static ImGuiWindow * CreateNewWindow(const char *name, ImVec2 size, ImGuiWindowFlags flags)
static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING *obj, int idx)
IMGUI_API bool BeginMenu(const char *label, bool enabled=true)
#define STB_TEXTEDIT_K_UNDO
IMGUI_API float GetTextLineHeightWithSpacing()
GLenum GLenum GLuint components
IMGUI_API void TextWrapped(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API void ListBoxFooter()
IMGUI_API void TextColored(const ImVec4 &col, const char *fmt,...) IM_FMTARGS(2)
ImVec4 Colors[ImGuiCol_COUNT]
#define STB_TEXTEDIT_K_TEXTEND
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border=true, float rounding=0.0f)
void PrimVtx(const ImVec2 &pos, const ImVec2 &uv, ImU32 col)
IMGUI_API float CalcItemWidth()
IMGUI_API void SetInt(ImGuiID key, int val)
static ImVec2 FindBestWindowPosForPopup(const ImVec2 &ref_pos, const ImVec2 &size, ImGuiDir *last_dir, const ImRect &r_avoid, ImGuiPopupPositionPolicy policy=ImGuiPopupPositionPolicy_Default)
ImDrawCallback UserCallback
IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_delay, float rate)
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow *r, STB_TEXTEDIT_STRING *obj, int line_start_idx)
IMGUI_API void LogToTTY(int max_depth=-1)
float MouseDoubleClickMaxDist
ImDrawVert * _VtxWritePtr
ImGuiLayoutType ParentLayoutType
static float GetScrollMaxY(ImGuiWindow *window)
IMGUI_API ImVec2 GetCursorScreenPos()
IMGUI_API ImGuiWindow * FindWindowByName(const char *name)
static bool ImIsPowerOfTwo(int v)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
IMGUI_API void NavMoveRequestCancel()
IMGUI_API bool DragIntN(const char *label, int *v, int components, float v_speed, int v_min, int v_max, const char *display_format)
int ImTextStrToUtf8(char *buf, int buf_size, const ImWchar *in_text, const ImWchar *in_text_end)
void(* RenderDrawListsFn)(ImDrawData *data)
char * ImStrdup(const char *str)
IMGUI_API void EndChildFrame()
IMGUI_API bool SliderInt3(const char *label, int v[3], int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags=0)
IMGUI_API void OpenPopupEx(ImGuiID id)
static ImVec2 ImRotate(const ImVec2 &v, float cos_a, float sin_a)
IMGUI_API bool SliderInt(const char *label, int *v, int v_min, int v_max, const char *display_format="%.0f")
void push_back(const value_type &v)
static void CalcResizePosSizeFromAnyCorner(ImGuiWindow *window, const ImVec2 &corner_target, const ImVec2 &corner_norm, ImVec2 *out_pos, ImVec2 *out_size)
static size_t GImAllocatorActiveAllocationsCount
IMGUI_API void PopItemWidth()
IMGUI_API void SetNextWindowBgAlpha(float alpha)
IMGUI_API void BringWindowToBack(ImGuiWindow *window)
static bool BeginChildEx(const char *name, ImGuiID id, const ImVec2 &size_arg, bool border, ImGuiWindowFlags extra_flags)
IMGUI_API void ScaleAllSizes(float scale_factor)
IMGUI_API bool DragFloatN(const char *label, float *v, int components, float v_speed, float v_min, float v_max, const char *display_format, float power)
ImVec2 ImTriangleClosestPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p)
IMGUI_API void PathArcTo(const ImVec2 ¢re, float radius, float a_min, float a_max, int num_segments=10)
IMGUI_API ImDrawList * GetOverlayDrawList()
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip=true)
IMGUI_API void EndColumns()
int FocusIdxAllRequestNext
IMGUI_API bool InputScalarEx(const char *label, ImGuiDataType data_type, void *data_ptr, void *step_ptr, void *step_fast_ptr, const char *scalar_format, ImGuiInputTextFlags extra_flags)
IMGUI_API void LogText(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API bool IsItemVisible()
IMGUI_API int * GetIntRef(ImGuiID key, int default_val=0)
IMGUI_API bool ButtonBehavior(const ImRect &bb, ImGuiID id, bool *out_hovered, bool *out_held, ImGuiButtonFlags flags=0)
static bool Items_SingleStringGetter(void *data, int idx, const char **out_text)
IMGUI_API bool BeginDragDropTarget()
ImVector< float > TextWrapPosStack
ImWchar InputCharacters[16+1]
IMGUI_API void EndFrame()
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate)
IMGUI_API float GetTextLineHeight()
IMGUI_API bool ItemHoverable(const ImRect &bb, ImGuiID id)
IMGUI_API bool SliderInt2(const char *label, int v[2], int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col)
IMGUI_API void LabelText(const char *label, const char *fmt,...) IM_FMTARGS(2)
IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char *label, float(*values_getter)(void *data, int idx), void *data, int values_count, int values_offset, const char *overlay_text, float scale_min, float scale_max, ImVec2 graph_size)
IMGUI_API ImGuiID GetActiveID()
static ImU32 ImAlphaBlendColor(ImU32 col_a, ImU32 col_b)
ImGuiConfigFlags ConfigFlags
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow *window)
IMGUI_API bool MenuItem(const char *label, const char *shortcut=NULL, bool selected=false, bool enabled=true)
static ImGuiWindow * FindHoveredWindow()
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2 &pos, float radius)
#define STB_TEXTEDIT_K_DOWN
void PathLineTo(const ImVec2 &pos)
void *(* ReadOpenFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler, const char *name)
IMGUI_API int GetFrameCount()
bool HoveredIdAllowOverlap
static void DataTypeFormatString(ImGuiDataType data_type, void *data_ptr, const char *display_format, char *buf, int buf_size)
int WantCaptureKeyboardNextFrame
IMGUI_API const char * GetClipboardText()
IMGUI_API bool Selectable(const char *label, bool selected=false, ImGuiSelectableFlags flags=0, const ImVec2 &size=ImVec2(0, 0))
IMGUI_API void SetNextWindowContentSize(const ImVec2 &size)
static const char * ImAtoi(const char *src, int *output)
IMGUI_API void NavInitWindow(ImGuiWindow *window, bool force_reinit)
static ImVec2 CalcSizeAutoFit(ImGuiWindow *window, const ImVec2 &size_contents)
IMGUI_API int GetKeyIndex(ImGuiKey imgui_key)
IMGUI_API void PopButtonRepeat()
IMGUI_API bool Checkbox(const char *label, bool *v)
static bool IsNavInputPressed(ImGuiNavInput n, ImGuiInputReadMode mode)
ImVector< ImDrawVert > VtxBuffer
IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags=0)
static ImVec2 InputTextCalcTextSizeW(const ImWchar *text_begin, const ImWchar *text_end, const ImWchar **remaining=NULL, ImVec2 *out_offset=NULL, bool stop_on_new_line=false)
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond=0)
static void ColorPickerOptionsPopup(ImGuiColorEditFlags flags, const float *ref_col)
static void NavUpdateWindowingHighlightWindow(int focus_change_dir)
IMGUI_API bool VSliderInt(const char *label, const ImVec2 &size, int *v, int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API float CalcWrapWidthForPos(const ImVec2 &pos, float wrap_pos_x)
static void SaveIniSettingsToDisk(const char *ini_filename)
IMGUI_API ImVec2 GetItemRectMax()
ImVector< ImGuiColumnsSet > ColumnsStorage
IMGUI_API float GetScrollY()
static float SliderBehaviorCalcRatioFromValue(float v, float v_min, float v_max, float power, float linear_zero_pos)
IMGUI_API void SetCursorScreenPos(const ImVec2 &pos)
static int IMGUI_CDECL ChildWindowComparer(const void *lhs, const void *rhs)
#define IM_COL32(R, G, B, A)
IMGUI_API bool InputFloatN(const char *label, float *v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags)
ImVec2 DisplayFramebufferScale
IMGUI_API void LogToClipboard(int max_depth=-1)
IMGUI_API void BringWindowToFront(ImGuiWindow *window)
static void NavProcessMoveRequestWrapAround(ImGuiWindow *window)
IMGUI_API void EndMenuBar()
IMGUI_API const char * GetVersion()
IMGUI_API float GetFrameHeight()
static void SetupDrawData(ImVector< ImDrawList *> *draw_lists, ImDrawData *out_draw_data)
ImVector< ImGuiGroupData > GroupStack
IMGUI_API void PushID(const char *str_id)
IMGUI_API bool DragIntRange2(const char *label, int *v_current_min, int *v_current_max, float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f", const char *display_format_max=NULL)
void(* ImGuiSizeCallback)(ImGuiSizeCallbackData *data)
IMGUI_API ImGuiID GetID(const char *str_id)
IMGUI_API bool InputTextEx(const char *label, char *buf, int buf_size, const ImVec2 &size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus)
static void SetClipboardTextFn_DefaultImpl(void *user_data, const char *text)
float TitleBarHeight() const
bool Overlaps(const ImRect &r) const
ImVector< ImGuiID > IDStack
ImGuiMouseCursor MouseCursor
ImVector< float > IndexAdvanceX
static void CheckStacksSize(ImGuiWindow *window, bool write)
int ImStricmp(const char *str1, const char *str2)
bool SelectedAllMouseLock
static void SaveIniSettingsToMemory(ImVector< char > &out_buf)
ImGuiNextWindowData NextWindowData
static bool ImCharIsSpace(int c)
static ImGuiCol GetWindowBgColorIdxFromFlags(ImGuiWindowFlags flags)
IMGUI_API void RenderTextClipped(const ImVec2 &pos_min, const ImVec2 &pos_max, const char *text, const char *text_end, const ImVec2 *text_size_if_known, const ImVec2 &align=ImVec2(0, 0), const ImRect *clip_rect=NULL)
ImGuiWindow * GetCurrentWindow()
static void SetWindowSize(ImGuiWindow *window, const ImVec2 &size, ImGuiCond cond)
IMGUI_API void SetAllInt(int val)
float DeclColumns(float w0, float w1, float w2)
int ImTextCountUtf8BytesFromStr(const ImWchar *in_text, const ImWchar *in_text_end)
IMGUI_API ImVec2 GetWindowPos()
#define STB_TEXTEDIT_K_SHIFT
IMGUI_API bool DragInt2(const char *label, int v[2], float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
void(* ReadLineFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler, void *entry, const char *line)
IMGUI_API ImGuiStyle & GetStyle()
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float &out_h, float &out_s, float &out_v)
static ImVec2 CalcSizeContents(ImGuiWindow *window)
static void RenderArrowsForVerticalBar(ImDrawList *draw_list, ImVec2 pos, ImVec2 half_sz, float bar_w)
GLenum GLuint GLint GLint layer
int ImTextStrFromUtf8(ImWchar *buf, int buf_size, const char *in_text, const char *in_text_end, const char **in_text_remaining)
IMGUI_API void SetItemAllowOverlap()
ImU32 TreeDepthMayJumpToParentOnPop
static void NavRestoreLayer(int layer)
IMGUI_API void CloseCurrentPopup()
IMGUI_API void PushClipRectFullScreen()
static void SetWindowCollapsed(ImGuiWindow *window, bool collapsed, ImGuiCond cond)
IMGUI_API void PopClipRect()
IMGUI_API bool TreeNodeExV(const char *str_id, ImGuiTreeNodeFlags flags, const char *fmt, va_list args) IM_FMTLIST(3)
float MouseDownDurationPrev[5]
IMGUI_API void OpenPopup(const char *str_id)
ImGuiCond SizeConstraintCond
IMGUI_API bool DragInt3(const char *label, int v[3], float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y)
static void * MallocWrapper(size_t size, void *user_data)
IMGUI_API ImGuiSettingsHandler * FindSettingsHandler(const char *type_name)
ImU32 ImHash(const void *data, int data_size, ImU32 seed)
IMGUI_API bool DragFloat3(const char *label, float v[3], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", float power=1.0f)
GLuint GLfloat GLfloat GLfloat x1
IMGUI_API bool SliderFloat(const char *label, float *v, float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
ImVector< char > InitialText
#define STB_TEXTEDIT_K_REDO
ImVector< TextRange > Filters
IMGUI_API void SetCursorPosY(float y)
ImVec2 BackupCursorMaxPos
ImVector< ImDrawIdx > IdxBuffer
IMGUI_API void TextDisabled(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API ImDrawData * GetDrawData()
IMGUI_API void ClearActiveID()
static float GetMinimumStepAtDecimalPrecision(int decimal_precision)
IMGUI_API const ImVec4 & GetStyleColorVec4(ImGuiCol idx)
static bool DataTypeApplyOpFromText(const char *buf, const char *initial_value_buf, ImGuiDataType data_type, void *data_ptr, const char *scalar_format)
IMGUI_API void Columns(int count=1, const char *id=NULL, bool border=true)
static void SetNavID(ImGuiID id, int nav_layer)
ImGuiStorage * StateStorage
IMGUI_API void SetWindowFontScale(float scale)
#define STB_TEXTEDIT_K_LINEEND
GLfloat GLfloat GLfloat GLfloat h
int memcmp(const void *cs, const void *ct, size_t n)
IMGUI_API float GetFrameHeightWithSpacing()
IMGUI_API void InsertChars(int pos, const char *text, const char *text_end=NULL)
IMGUI_API bool DragInt(const char *label, int *v, float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API bool IsMouseDoubleClicked(int button)
bool Contains(const ImVec2 &p) const
static void AddWindowToSortedBuffer(ImVector< ImGuiWindow *> *out_sorted_windows, ImGuiWindow *window)
static void ClosePopupToLevel(int remaining)
IMGUI_API void StyleColorsClassic(ImGuiStyle *dst=NULL)
IMGUI_API bool IsAnyItemActive()
static ImGuiDir NavScoreItemGetQuadrant(float dx, float dy)
GLsizei const GLfloat * values
GLenum GLenum GLenum GLenum GLenum scale
float BackupCurrentLineHeight
IMGUI_API void PrimReserve(int idx_count, int vtx_count)
static bool IsNavInputPressedAnyOfTwo(ImGuiNavInput n1, ImGuiNavInput n2, ImGuiInputReadMode mode)
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float &out_r, float &out_g, float &out_b)
IMGUI_API bool SetDragDropPayload(const char *type, const void *data, size_t size, ImGuiCond cond=0)
static void LoadIniSettingsFromDisk(const char *ini_filename)
IMGUI_API void PlotLines(const char *label, const float *values, int values_count, int values_offset=0, const char *overlay_text=NULL, float scale_min=FLT_MAX, float scale_max=FLT_MAX, ImVec2 graph_size=ImVec2(0, 0), int stride=sizeof(float))
IMGUI_API ImDrawListSharedData * GetDrawListSharedData()
IMGUI_API void ChannelsSplit(int channels_count)
IMGUI_API float GetCursorPosY()
IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags)
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags)
void Add(const ImVec2 &p)
IMGUI_API void SetKeyboardFocusHere(int offset=0)
IMGUI_API bool IsClippedEx(const ImRect &bb, ImGuiID id, bool clip_even_when_logged)
IMGUI_API void LogFinish()
ImRect LastItemDisplayRect
IMGUI_API int ParseFormatPrecision(const char *fmt, int default_value)
#define IM_F32_TO_INT8_UNBOUND(_VAL)
void ImStrncpy(char *dst, const char *src, size_t count)
ImGuiWindow * GetCurrentWindowRead()
IMGUI_API void SetScrollX(float scroll_x)
ImVector< ImGuiPopupRef > CurrentPopupStack
ImVector< float > ItemWidthStack
IMGUI_API void TreeAdvanceToLabelPos()
IMGUI_API bool GetBool(ImGuiID key, bool default_val=false) const
int ImGuiNavDirSourceFlags
IMGUI_API bool InputInt(const char *label, int *v, int step=1, int step_fast=100, ImGuiInputTextFlags extra_flags=0)
GLuint GLsizei const GLchar * label
ImGuiCond SetWindowSizeAllowFlags
IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in)
float MenuBarHeight() const
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul=1.0f)
static void NavUpdateWindowing()
IMGUI_API void PopStyleColor(int count=1)
ImVector< ImGuiWindow * > ChildWindows
char TempBuffer[1024 *3+1]
int BeginOrderWithinParent
ImVector< unsigned short > IndexLookup
ImGuiID NavNextActivateId
int ImTextCountCharsFromUtf8(const char *in_text, const char *in_text_end)
ImVector< ImVec4 > _ClipRectStack
IMGUI_API void EndMainMenuBar()
IMGUI_API bool VSliderFloat(const char *label, const ImVec2 &size, float *v, float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
float CalcExtraSpace(float avail_w)
IMGUI_API void TextDisabledV(const char *fmt, va_list args) IM_FMTLIST(1)
IMGUI_API bool IsAnyMouseDown()
IMGUI_API void SetWindowSize(const ImVec2 &size, ImGuiCond cond=0)